Merge branch 'develop'
This commit is contained in:
+17
-2
@@ -158,9 +158,10 @@ if (!function_exists('sendFeishuTextMessage')) {
|
||||
* 替换模板
|
||||
*/
|
||||
if (!function_exists('replaceTpl')) {
|
||||
function replaceTpl(array $data = [], string $templatePath = 'common/utils/scaffold/templates/Email.stub')
|
||||
function replaceTpl(array $data = [], string $tplKey = 'email')
|
||||
{
|
||||
if (!$data || !$templatePath) return '';
|
||||
if (!$data || !$tplKey) return '';
|
||||
$templatePath = tplUrl($tplKey);
|
||||
$templatePath = app_path($templatePath);
|
||||
$content = file_get_contents($templatePath);
|
||||
foreach ($data as $key => $value) {
|
||||
@@ -170,6 +171,20 @@ if (!function_exists('replaceTpl')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板路径
|
||||
*/
|
||||
if (!function_exists('tplUrl')) {
|
||||
function tplUrl(string $tplKey = '')
|
||||
{
|
||||
$urlArray = [
|
||||
'email' => 'common/utils/scaffold/templates/Email.stub',
|
||||
'work_order' => 'common/utils/scaffold/templates/workOrder.stub'
|
||||
];
|
||||
return $urlArray[$tplKey];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换模板
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user