自动推广
This commit is contained in:
@@ -128,7 +128,7 @@ class PromotionService
|
||||
'send_time' => $now,
|
||||
]);
|
||||
Db::name('journal_email')->where('j_email_id', $account['j_email_id'])->setInc('today_sent');
|
||||
Db::name('expert')->where('expert_id', $expert['expert_id'])->update(['ltime' => $now]);
|
||||
Db::name('expert')->where('expert_id', $expert['expert_id'])->update(['state' => 1, 'ltime' => $now]);
|
||||
Db::name('promotion_task')->where('task_id', $taskId)->setInc('sent_count');
|
||||
} else {
|
||||
Db::name('promotion_email_log')->where('log_id', $logEntry['log_id'])->update([
|
||||
@@ -183,6 +183,7 @@ class PromotionService
|
||||
$failed = 0;
|
||||
$now = time();
|
||||
|
||||
$journalVars = $this->buildJournalVars($journal);
|
||||
foreach ($logs as $log) {
|
||||
$expert = Db::name('expert')->where('expert_id', $log['expert_id'])->find();
|
||||
if (!$expert) {
|
||||
@@ -196,7 +197,6 @@ class PromotionService
|
||||
}
|
||||
|
||||
$expertVars = $this->buildExpertVars($expert);
|
||||
$journalVars = $this->buildJournalVars($journal);
|
||||
$vars = array_merge($journalVars, $expertVars);
|
||||
$rendered = $this->renderFromTemplate(
|
||||
$task['template_id'],
|
||||
@@ -439,8 +439,8 @@ class PromotionService
|
||||
if ($styleId) {
|
||||
$style = Db::name('mail_style')->where('style_id', $styleId)->where('state', 0)->find();
|
||||
if ($style) {
|
||||
$header = $style['header_html'] ?? '';
|
||||
$footer = $style['footer_html'] ?? '';
|
||||
$header = $style['header_html'] ? $this->renderVars($style['header_html'],$vars):'';
|
||||
$footer = $style['footer_html'] ? $this->renderVars($style['footer_html'],$vars): '';
|
||||
$finalBody = $header . $body . $footer;
|
||||
}
|
||||
}
|
||||
@@ -451,20 +451,33 @@ class PromotionService
|
||||
public function buildExpertVars($expert)
|
||||
{
|
||||
return [
|
||||
'name' => $expert['name'] ?? '',
|
||||
'email' => $expert['email'] ?? '',
|
||||
'affiliation' => $expert['affiliation'] ?? '',
|
||||
'field' => $expert['field'] ?? '',
|
||||
'expert_title' => "Ph.D",
|
||||
'expert_name' => $expert['name'] ?? '',
|
||||
'expert_email' => $expert['email'] ?? '',
|
||||
'expert_affiliation' => $expert['affiliation'] ?? '',
|
||||
'expert_field' => $expert['field'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function buildJournalVars($journal)
|
||||
{
|
||||
if (!$journal) return [];
|
||||
$zb = Db::name("board_to_journal")
|
||||
->where("journal_id",$journal['journal_id'])
|
||||
->where("state",0)
|
||||
->where('type',0)
|
||||
->find();
|
||||
|
||||
return [
|
||||
'journal_title' => $journal['title'] ?? '',
|
||||
'journal_name' => $journal['title'] ?? '',
|
||||
'journal_abbr' => $journal['jabbr'] ?? '',
|
||||
'journal_url' => $journal['website'] ?? '',
|
||||
'journal_email' => $journal['email'] ?? '',
|
||||
'indexing_databases' => $journal['databases'] ?? '',
|
||||
'submission_url' => "https://submission.tmrjournals.com/",
|
||||
'eic_name' => $zb['realname'] ?? '',
|
||||
'editor_name' => $journal['editor_name'],
|
||||
'special_support_deadline'=>date("Y-m-d",strtotime("+30 days"))
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user