作者邮箱修改
This commit is contained in:
@@ -76,6 +76,7 @@ class Cronmonitor extends Controller
|
||||
$aParam['date'] = $sDate;
|
||||
$aResult = object_to_array(json_decode(myPost($sUrl, $aParam)));
|
||||
$aContent = empty($aResult['data']) ? [] : $aResult['data'];
|
||||
|
||||
if(empty($aContent)){
|
||||
$this->showMessage($aResult['msg'] ?? '接口异常',2);
|
||||
exit;
|
||||
@@ -99,32 +100,12 @@ class Cronmonitor extends Controller
|
||||
exit;
|
||||
}
|
||||
$aArticleId = array_unique(array_column($aArticleAuthor, 'article_id'));
|
||||
//查询关联关系
|
||||
$aWhere = ['w_article_id' => ['in',$aArticleId]];
|
||||
$aProductionArticle = Db::name('production_article')->where($aWhere)->column('article_id,w_article_id');
|
||||
if(empty($aProductionArticle)){
|
||||
$this->showMessage('production_article is null');
|
||||
exit;
|
||||
}
|
||||
|
||||
$aArticleId = array_keys($aProductionArticle);
|
||||
$aWhere = ['article_id' => ['in',$aArticleId],'state' => 0,'email' => ['<>','']];
|
||||
$aArticleAuthor = Db::name('article_author')->field('article_id,firstname,lastname,art_aut_id as article_author_id,email')->where($aWhere)->order('article_id asc')->select();
|
||||
if(empty($aArticleAuthor)){
|
||||
$this->showMessage('No author information found for the article');
|
||||
exit;
|
||||
}
|
||||
|
||||
//获取数据-文章数据
|
||||
$aArticle = empty($aContent['article']) ? [] : $aContent['article'];
|
||||
//期刊数据
|
||||
$aJournal = empty($aContent['journal']) ? [] : $aContent['journal'];
|
||||
|
||||
// //查询发送人信息
|
||||
// $aEmail = array_column($aArticleAuthor, 'email');
|
||||
// $aWhere = ['email' => ['in',$aEmail]];
|
||||
// $aUser = Db::name('user')->where($aWhere)->column('email,realname,localname');
|
||||
|
||||
//查询邮件发送日志
|
||||
$aArticleCiteId = array_column($aArticleCite, 'article_cite_id');
|
||||
$aWhere = ['article_cite_id' => ['in',$aArticleCiteId],'is_success' => 1];
|
||||
@@ -140,21 +121,14 @@ class Cronmonitor extends Controller
|
||||
$aEmailCite= $this->aEmailConfig['cite'];
|
||||
//邮件发送日志记录数组
|
||||
$aEmailLog = [];
|
||||
|
||||
$aSendEmail = [];//['2101' => ['mohammadalipour_z@yahoo.com']];
|
||||
foreach ($aArticleAuthor as $key => $value) {
|
||||
|
||||
//作者邮箱-发送信息
|
||||
$email = empty($value['email']) ? '' : $value['email'];
|
||||
if(empty($email)){
|
||||
continue;
|
||||
}
|
||||
//文章ID转换
|
||||
$value['article_id'] = empty($aProductionArticle[$value['article_id']]) ? 0 : $aProductionArticle[$value['article_id']];
|
||||
if(empty($value['article_id'])){
|
||||
continue;
|
||||
}
|
||||
//发件人姓名拼接
|
||||
$value['author_name'] = empty($value['lastname']) ? '' : $value['lastname'];
|
||||
$value['author_name'] .= empty($value['firstname']) ? '' : ' ' .$value['firstname'];
|
||||
|
||||
//获取引用文章信息
|
||||
$aArticleCite = empty($aCite[$value['article_id']]) ? [] : $aCite[$value['article_id']];
|
||||
@@ -163,10 +137,16 @@ class Cronmonitor extends Controller
|
||||
continue;
|
||||
}
|
||||
|
||||
//判断同一个邮箱是否重复发送
|
||||
if(!empty($aSendEmail[$value['article_id']]) && in_array($email, $aSendEmail[$value['article_id']])){
|
||||
continue;
|
||||
}
|
||||
|
||||
//用户信息
|
||||
$realname = empty($value['author_name']) ? $email : $value['author_name'];
|
||||
//邮件日志
|
||||
$aEmailLogInfo = empty($aLog[$email]) ? [] : $aLog[$email];
|
||||
|
||||
foreach ($aArticleCite as $val) {
|
||||
if(in_array($val['article_cite_id'], $aEmailLogInfo)){
|
||||
$this->showMessage('文章标题为:'.$val['article_name'].'邮箱账号为:'.$email."已发送过邮件\n\n",2);
|
||||
@@ -214,15 +194,16 @@ class Cronmonitor extends Controller
|
||||
$memail = empty($aJournalInfo['email']) ? '' : $aJournalInfo['email'];
|
||||
$mpassword = empty($aJournalInfo['epassword']) ? '' : $aJournalInfo['epassword'];
|
||||
$aResult = sendEmail($email,$title,$from_name,$content,$memail,$mpassword);
|
||||
$iStatus = isset($aResult['status']) ? $aResult['status'] : '-1';
|
||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||
$iIsSuccess = 2;
|
||||
$sMsg = empty($aResult['msg']) ? '未知' : $aResult['msg'];
|
||||
if($iStatus == 0){
|
||||
if($iStatus == 1){
|
||||
$iIsSuccess = 1;
|
||||
$sMsg = '成功';
|
||||
}
|
||||
$this->showMessage('给邮箱:'.$email.'发送邮件-'.$sMsg."\n\n",2);
|
||||
$aEmailLog[] = ['article_id' => $val['article_id'],'article_cite_id' => $val['article_cite_id'],'email' => $email,'content' => $content,'create_tiem' => time(),'is_success' => $iIsSuccess,'journal_id' => $val['journal_id'],'journal_issn' => $aJournalInfo['issn'],'msg' => $sMsg];
|
||||
$aSendEmail[$value['article_id']][] = $email;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user