refactor(app): 优化邮件模板

master
cody 2 months ago
parent 8ce9eb7ce0
commit d7c8736a73

@ -87,7 +87,7 @@ class UpdateCompany extends Command
'logo' => $result['logo'], 'logo' => $result['logo'],
'company_legal_representative' => $result['operName'], 'company_legal_representative' => $result['operName'],
'company_province' => $result['province'], 'company_province' => $result['province'],
'company_industry' => $result['qccIndustry'], 'company_industry' => combineKeyValue($result['qccIndustry']),
'regist_amount' => $result['registAmount'], 'regist_amount' => $result['registAmount'],
'regist_capi_type' => $result['registCapiType'], 'regist_capi_type' => $result['registCapiType'],
'company_date' => $result['startDate'], 'company_date' => $result['startDate'],
@ -96,7 +96,7 @@ class UpdateCompany extends Command
'currency_type' => $result['currencyType'], 'currency_type' => $result['currencyType'],
'stock_number' => $result['stockNumber'], 'stock_number' => $result['stockNumber'],
'stock_type' => $result['stockType'], 'stock_type' => $result['stockType'],
'company_tag' => implode(',', $result['companyTag']), 'company_tag' => implode(',', $result['tagList']),
]; ];
$company = Company::updateOrCreate($where, $data); $company = Company::updateOrCreate($where, $data);
// 更新用户关联 // 更新用户关联

@ -718,3 +718,31 @@ function getDates($start, $end)
} }
return $temp; // 返回data型数据 return $temp; // 返回data型数据
} }
/**
* 将JSON字符串或数组的键值对组合成"键:值,键:值"格式的字符串
*
* @param string|array $data 可以是JSON字符串或关联数组
* @return string 组合后的字符串
*/
function combineKeyValue($data)
{
// 如果输入是JSON字符串则解析为数组
if (is_string($data)) {
$data = json_decode($data, true);
}
// 验证是否为数组
if (!is_array($data)) {
return '';
}
// 拼接键值对
$parts = [];
foreach ($data as $key => $value) {
$parts[] = "{$key}:{$value}";
}
// 用逗号连接
return implode(',', $parts);
}

Loading…
Cancel
Save