diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index adcf9e8..98fc1c2 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -1286,6 +1286,12 @@ class Article extends Base ->where('t_article_reviewer.article_id', $article_info['article_id']) ->where('t_article_reviewer.state', 'in', [1, 3]) ->select(); + $rev_list_t = $this->article_reviewer_obj + ->field('t_article_reviewer_question.*') + ->join("t_article_reviewer_question", 't_article_reviewer_question.art_rev_id = t_article_reviewer.art_rev_id', 'left') + ->where('t_article_reviewer.article_id', $article_info['article_id']) + ->where('t_article_reviewer.state', 2) + ->select(); foreach ($rev_list as $v) { $content = $v['qu9_contents'] . " " . $v['qu10_contents'] . " " . $v['qu11_contents'] . " " . $v['qu12_contents'] . " " . $v['qu13_contents'] . " " . $v['qu14_contents'] . " " . $v['qu15_contents'] . " " . $v['comments']; if (preg_match('/[\x{4e00}-\x{9fa5}]/u', $content) > 0) { //含有中文 @@ -1299,8 +1305,8 @@ class Article extends Base } } } - if ($rev_real_num < 2) { - return json(['code' => 1, 'msg' => "More than two available reviewer-comments are necessary before going next step."]); + if ($rev_real_num < 2&&$rev_real_num>count($rev_list_t)) { + return json(['code' => 1, 'msg' => "Before proceeding to the next step, you need more than two available reviewer comments, and the total number of accept is greater than the total number of rejected."]); } } //接收必须查重小于20% diff --git a/application/api/controller/Email.php b/application/api/controller/Email.php index 40a9dcc..553ba0c 100644 --- a/application/api/controller/Email.php +++ b/application/api/controller/Email.php @@ -7,7 +7,8 @@ use think\Db; use think\Queue; use think\Validate; -class Email extends Controller{ +class Email extends Controller +{ protected $article_obj = ''; protected $user_obj = ''; @@ -36,7 +37,8 @@ class Email extends Controller{ protected $email_log_obj = ''; protected $email_template_obj = ''; - public function __construct(\think\Request $request = null) { + public function __construct(\think\Request $request = null) + { parent::__construct($request); $this->user_obj = Db::name('user'); $this->user_act_obj = Db::name('user_act'); @@ -67,23 +69,22 @@ class Email extends Controller{ } - - /** * 添加邮件模板 */ - public function addEmailTemplate(){ + public function addEmailTemplate() + { $data = $this->request->post(); $rule = new Validate([ - 'etitle'=>'require', - 'epid'=>'require', + 'etitle' => 'require', + 'epid' => 'require', ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } $insert['etitle'] = $data['etitle']; $insert['epid'] = $data['epid']; - $insert['econtent'] = isset($data['econtent'])?$data['econtent']:''; + $insert['econtent'] = isset($data['econtent']) ? $data['econtent'] : ''; $this->email_template_obj->insert($insert); return jsonSuccess([]); } @@ -91,32 +92,34 @@ class Email extends Controller{ /** * 删除邮件模板 */ - public function delEmailTemplate(){ + public function delEmailTemplate() + { $data = $this->request->post(); $rule = new Validate([ - 'eid'=>'require' + 'eid' => 'require' ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $info = $this->email_template_obj->where('eid',$data['eid'])->find(); - if($info['epid']==0){ - $check = $this->email_template_obj->where('epid',$info['eid'])->where('estate',0)->find(); - if($check){ + $info = $this->email_template_obj->where('eid', $data['eid'])->find(); + if ($info['epid'] == 0) { + $check = $this->email_template_obj->where('epid', $info['eid'])->where('estate', 0)->find(); + if ($check) { return jsonError('Please delete all subitems first!'); } } - $this->email_template_obj->where('eid',$data['eid'])->update(['estate'=>1]); + $this->email_template_obj->where('eid', $data['eid'])->update(['estate' => 1]); return jsonSuccess([]); } /** * 获取全部邮件模板 */ - public function getAllEmailTemplate(){ - $list = $this->email_template_obj->where('epid',0)->where('estate',0)->select(); - foreach($list as $k => $v){ - $cache = $this->email_template_obj->where('epid',$v['eid'])->where('estate',0)->select(); + public function getAllEmailTemplate() + { + $list = $this->email_template_obj->where('epid', 0)->where('estate', 0)->select(); + foreach ($list as $k => $v) { + $cache = $this->email_template_obj->where('epid', $v['eid'])->where('estate', 0)->select(); $list[$k]['children'] = $cache; } $re['templates'] = $list; @@ -126,15 +129,16 @@ class Email extends Controller{ /** * 获取邮件模板 */ - public function getEmailTemplate(){ + public function getEmailTemplate() + { $data = $this->request->post(); $rule = new Validate([ - 'eid'=>'require' + 'eid' => 'require' ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $info = $this->email_template_obj->where('eid',$data['eid'])->where('estate',0)->find(); + $info = $this->email_template_obj->where('eid', $data['eid'])->where('estate', 0)->find(); $re['template'] = $info; return jsonSuccess($re); } @@ -142,42 +146,44 @@ class Email extends Controller{ /** * 增加模板调用计数 */ - public function addEmailTemplateNum(){ + public function addEmailTemplateNum() + { $data = $this->request->post(); $rule = new Validate([ - 'eid'=>'require' + 'eid' => 'require' ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $this->email_template_obj->where('eid',$data['eid'])->setInc('num'); + $this->email_template_obj->where('eid', $data['eid'])->setInc('num'); return jsonSuccess([]); } /** * 发送模板邮件 */ - public function pushEmailOnTemplate(){ + public function pushEmailOnTemplate() + { $data = $this->request->post(); $rule = new Validate([ - 'email'=>'require', - 'content'=>'require', - 'article_id'=>'require' + 'email' => 'require', + 'content' => 'require', + 'article_id' => 'require' ]); - if(!$rule->check($data)){ + if (!$rule->check($data)) { return jsonError($rule->getError()); } - $article_info = $this->article_obj->where('article_id',$data['article_id'])->find(); - $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find(); + $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); + $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); + - $maidata['email'] = $data['email']; $maidata['title'] = $journal_info['title']; $maidata['content'] = $data['content']; $maidata['tmail'] = $journal_info['email']; $maidata['tpassword'] = $journal_info['epassword']; $maidata['article_id'] = $data['article_id']; - $maidata['attachmentFile'] = (isset($data['attachment'])&&$data['attachment']!='')?ROOT_PATH . 'public' . DS . $data['attachment']:''; + $maidata['attachmentFile'] = (isset($data['attachment']) && $data['attachment'] != '') ? ROOT_PATH . 'public' . DS . $data['attachment'] : ''; Queue::push('app\api\job\mail@tgpu', $maidata, "tmail"); @@ -186,39 +192,48 @@ class Email extends Controller{ } + public function lsPushEmail() + { +// $journal_info = $this->journal_obj->where("journal_id", 4)->find(); +// $list[] = "751475802@qq.com"; +// $list[] = "15122276210@163.com"; - public function lsPushEmail(){ - $journal_info = $this->journal_obj->where("journal_id",1)->find(); - $list[] = "751475802@qq.com"; - $list[] = "17627882183@163.com"; -// $list = $this->user_obj->where("state",0)->select(); -// echo "
"; -// var_dump($list); -// echo ""; -// die; - $tt = "Dear