作者邮箱修改
This commit is contained in:
@@ -7,7 +7,7 @@ class JournalArticle
|
|||||||
{
|
{
|
||||||
|
|
||||||
//官网接口地址
|
//官网接口地址
|
||||||
protected static $sApiUrl = 'http://journalapi.tmrjournals.com/public/index.php/';//'http://zmzm.journal.dev.com/';
|
protected static $sApiUrl = 'http://journalapi.tmrjournals.com/public/index.php/';//'http://zmzm.journal.dev.com/';//
|
||||||
|
|
||||||
//期刊官网
|
//期刊官网
|
||||||
protected static $sJournalUsx = 'https://www.tmrjournals.com/';
|
protected static $sJournalUsx = 'https://www.tmrjournals.com/';
|
||||||
@@ -85,19 +85,35 @@ class JournalArticle
|
|||||||
if(empty($aJournal)){
|
if(empty($aJournal)){
|
||||||
return json_encode(['status' => 5,'msg' => 'The journal to which the article belongs does not exist']);
|
return json_encode(['status' => 5,'msg' => 'The journal to which the article belongs does not exist']);
|
||||||
}
|
}
|
||||||
//文章作者
|
|
||||||
|
//获取数据-文章通讯作者数据
|
||||||
$aAuthor = empty($aData['author']) ? [] : $aData['author'];
|
$aAuthor = empty($aData['author']) ? [] : $aData['author'];
|
||||||
|
if(empty($aAuthor)){
|
||||||
|
return json_encode(['status' => 5,'msg' => '未查询到引用文章作者数据']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询关联关系
|
||||||
|
$aArticleId = array_unique(array_column($aAuthor,'article_id'));
|
||||||
|
$aWhere = ['w_article_id' => ['in',$aArticleId]];//,'state' => ['in',[0,2]]
|
||||||
|
$aProductionArticle = Db::name('production_article')->where($aWhere)->column('article_id,w_article_id');
|
||||||
|
if(empty($aProductionArticle)){
|
||||||
|
return json_encode(['status' => 6,'msg' => 'production_article is null']);
|
||||||
|
}
|
||||||
|
//获取作者信息
|
||||||
|
$aArticleId = array_keys($aProductionArticle);
|
||||||
|
$aWhere = ['article_id' => ['in',$aArticleId],'state' => 0,'email' => ['<>','']];
|
||||||
|
$aAuthor = 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($aAuthor)){
|
if(empty($aAuthor)){
|
||||||
return json_encode(['status' => 6,'msg' => 'No author information found for the article']);
|
return json_encode(['status' => 6,'msg' => 'No author information found for the article']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询邮件发送日志
|
//查询邮件发送日志
|
||||||
$aWhere = ['article_id' => $iArticleId,'is_success' => 1];
|
$aWhere = ['article_id' => $iArticleId,'is_success' => 1];
|
||||||
$aEmailLog = Db::name('email_related_article')->field('related_article_id,article_author_id')->where($aWhere)->select();
|
$aEmailLog = Db::name('email_related_article')->field('related_article_id,email')->where($aWhere)->select();
|
||||||
$aLog = [];
|
$aLog = [];
|
||||||
if(!empty($aEmailLog)){
|
if(!empty($aEmailLog)){
|
||||||
foreach ($aEmailLog as $key => $value) {
|
foreach ($aEmailLog as $key => $value) {
|
||||||
$aLog[$value['related_article_id']][] = $value['article_author_id'];
|
$aLog[$value['related_article_id']][] = $value['email'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,15 +125,22 @@ class JournalArticle
|
|||||||
foreach ($aAuthor as $key => $value) {
|
foreach ($aAuthor as $key => $value) {
|
||||||
|
|
||||||
//作者邮箱-发送信息
|
//作者邮箱-发送信息
|
||||||
$email = empty($value['email']) ? '' : $value['email'];
|
$email = empty($value['email']) ? '' : $value['email'];//'tmr@tmrjournals.com';//'1172937051@qq.com';//
|
||||||
if(empty($email)){
|
if(empty($email)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$email = $value['email'];//'tmr@tmrjournals.com';//'1172937051@qq.com';//
|
//文章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'];
|
||||||
|
|
||||||
//判断是否发送过邮件
|
//判断是否发送过邮件
|
||||||
//邮件日志
|
$aEmailLogInfo = empty($aLog[$value['article_id']]) ? [] : $aLog[$value['article_id']];//邮件日志
|
||||||
$aEmailLogInfo = empty($aLog[$value['article_id']]) ? [] : $aLog[$value['article_id']];
|
if(in_array($value['email'], $aEmailLogInfo)){
|
||||||
if(in_array($value['article_author_id'], $aEmailLogInfo)){
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,9 +209,9 @@ class JournalArticle
|
|||||||
$iIsSuccess = 1;
|
$iIsSuccess = 1;
|
||||||
$sMsg = '成功';
|
$sMsg = '成功';
|
||||||
}
|
}
|
||||||
$aEmaiParam = ['article_id' => $iArticleId,'article_author_id' =>$value['article_author_id'],'related_article_id' => $value['article_id'],'email' => $email,'content' => $content,'create_time' => time(),'journal_id' => $aJournalInfo['journal_id'],'journal_issn' => $aJournalInfo['issn'],'email' => $email,'title' => $title,'from_name' => $from_name,'content' => $content,'memail' => $memail,'mpassword' => $mpassword];
|
$aEmailParam = ['article_id' => $iArticleId,'article_author_id' =>$value['article_author_id'],'related_article_id' => $value['article_id'],'email' => $email,'content' => $content,'create_time' => time(),'journal_id' => $aJournalInfo['journal_id'],'journal_issn' => $aJournalInfo['issn'],'email' => $email,'title' => $title,'from_name' => $from_name,'memail' => $memail,'mpassword' => $mpassword];
|
||||||
//调用邮件发送队列
|
//调用邮件发送队列
|
||||||
Queue::push('app\api\job\SendRelatedArticleEmail@fire', $aEmaiParam, 'SendRelatedArticleEmail');
|
Queue::push('app\api\job\SendRelatedArticleEmail@fire', $aEmailParam, 'SendRelatedArticleEmail');
|
||||||
}
|
}
|
||||||
return json_encode(['status' => 1,'msg' => 'Added to email sending queue']);
|
return json_encode(['status' => 1,'msg' => 'Added to email sending queue']);
|
||||||
}
|
}
|
||||||
@@ -221,9 +244,8 @@ class JournalArticle
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static function getLog($aParam = []) {
|
static function getLog($aParam = []) {
|
||||||
|
|
||||||
//查询条件判断
|
//查询条件判断
|
||||||
if(empty($aParam['article_id']) || empty($aParam['article_author_id']) || empty($aParam['related_article_id'])){
|
if(empty($aParam['article_id']) || empty($aParam['email']) || empty($aParam['related_article_id'])){
|
||||||
return json_encode(['status' => 2,'msg' => 'Missing parameter']);
|
return json_encode(['status' => 2,'msg' => 'Missing parameter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user