作者邮箱修改
This commit is contained in:
@@ -91,22 +91,39 @@ class Cronmonitor extends Controller
|
||||
foreach ($aArticleCite as $key => $value) {
|
||||
$aCite[$value['article_id']][] = $value;
|
||||
}
|
||||
|
||||
//获取数据-文章通讯作者数据
|
||||
$aArticleAuthor = empty($aContent['article_author']) ? [] : $aContent['article_author'];
|
||||
if(empty($aArticleAuthor)){
|
||||
$this->showMessage('未查询到引用文章通讯作者数据:'.$sDate,2);
|
||||
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');
|
||||
// //查询发送人信息
|
||||
// $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');
|
||||
@@ -123,26 +140,31 @@ class Cronmonitor extends Controller
|
||||
$aEmailCite= $this->aEmailConfig['cite'];
|
||||
//邮件发送日志记录数组
|
||||
$aEmailLog = [];
|
||||
|
||||
foreach ($aArticleAuthor as $key => $value) {
|
||||
if(empty($value['email'])){//邮箱为空
|
||||
//作者邮箱-发送信息
|
||||
$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']];
|
||||
if(empty($aArticleCite)){
|
||||
$this->showMessage('未查询到文章引用信息为空,文章ID:'.$value['article_id']."\n\n",2);
|
||||
continue;
|
||||
}
|
||||
//数据组装-接收邮箱
|
||||
// $email = '1172937051@qq.com';//$value['email'];
|
||||
$email = $value['email'];
|
||||
|
||||
//用户信息
|
||||
$aUserInfo = empty($aUser[$value['email']]) ? [] : $aUser[$value['email']];
|
||||
$realname = empty($aUserInfo['realname']) ? '' : $aUserInfo['realname'];
|
||||
$localname = empty($aUserInfo['localname']) ? '' : $aUserInfo['localname'];
|
||||
$realname = empty($realname) ? $localname : $realname;
|
||||
$realname = empty($value['author_name']) ? $realname : $value['author_name'];
|
||||
|
||||
$realname = empty($value['author_name']) ? $email : $value['author_name'];
|
||||
//邮件日志
|
||||
$aEmailLogInfo = empty($aLog[$email]) ? [] : $aLog[$email];
|
||||
foreach ($aArticleCite as $val) {
|
||||
@@ -192,10 +214,10 @@ 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 = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||
$iStatus = isset($aResult['status']) ? $aResult['status'] : '-1';
|
||||
$iIsSuccess = 2;
|
||||
$sMsg = empty($aResult['data']) ? '失败' : $aResult['data'];
|
||||
if($iStatus == 1){
|
||||
$sMsg = empty($aResult['msg']) ? '未知' : $aResult['msg'];
|
||||
if($iStatus == 0){
|
||||
$iIsSuccess = 1;
|
||||
$sMsg = '成功';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user