Browse Source

开票信息 开票成功 邮箱推送消息2

master
wanghongjun 1 year ago
parent
commit
44d945986e
  1. 34
      app/controller/task/InvoiceIssuanceTask.php

34
app/controller/task/InvoiceIssuanceTask.php

@ -26,19 +26,7 @@ class InvoiceIssuanceTask extends Base
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) { foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
$result = (new InvoiceIssuanceService())->IssueAnInvoice($InvoiceIssuanceValue); $result = (new InvoiceIssuanceService())->IssueAnInvoice($InvoiceIssuanceValue);
if ($result === true) { if ($result === true) {
$this->invoiceSuccess($InvoiceIssuanceValue);
if ($InvoiceIssuanceValue['email']) {
// 发送发票到邮箱
$path = InvoiceIssuanceService::getQrCode($InvoiceIssuanceValue['id']);
$emailResult = (new EmailService())->sendInvoice($InvoiceIssuanceValue['email'], '发票', $path);
if ($emailResult === true && $InvoiceIssuanceValue['mobile']) {
// 发送短信
$SmsService = new SmsService();
$SmsService->sendSms($InvoiceIssuanceValue['mobile'], $SmsService->smsInvoiceTemplate($InvoiceIssuanceValue['email']));
}
}
} }
} }
return $this->buildSuccess(); return $this->buildSuccess();
@ -58,9 +46,27 @@ class InvoiceIssuanceTask extends Base
$where = ['status' => 1, 'delete_time' => 0]; $where = ['status' => 1, 'delete_time' => 0];
$InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $limit)->select(); $InvoiceIssuanceData = (new InvoiceIssuanceModel())->where($where)->page(1, $limit)->select();
foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) { foreach ($InvoiceIssuanceData as $InvoiceIssuanceValue) {
(new InvoiceIssuanceService())->cancelInitiateAgain($InvoiceIssuanceValue); $result = (new InvoiceIssuanceService())->cancelInitiateAgain($InvoiceIssuanceValue);
if ($result === true) {
$this->invoiceSuccess($InvoiceIssuanceValue);
}
} }
return $this->buildSuccess(); return $this->buildSuccess();
} }
private function invoiceSuccess($InvoiceIssuanceValue)
{
if ($InvoiceIssuanceValue['email']) {
// 发送发票到邮箱
$path = InvoiceIssuanceService::getQrCode($InvoiceIssuanceValue['id']);
$emailResult = (new EmailService())->sendInvoice($InvoiceIssuanceValue['email'], '发票', $path);
if ($emailResult === true && $InvoiceIssuanceValue['mobile']) {
// 发送短信
$SmsService = new SmsService();
$SmsService->sendSms($InvoiceIssuanceValue['mobile'], $SmsService->smsInvoiceTemplate($InvoiceIssuanceValue['email']));
}
}
}
} }

Loading…
Cancel
Save