正在显示
3 个修改的文件
包含
45 行增加
和
1 行删除
| @@ -97,7 +97,7 @@ class SyncSubmitTask extends Command | @@ -97,7 +97,7 @@ class SyncSubmitTask extends Command | ||
| 97 | } | 97 | } |
| 98 | $task_info->save(); | 98 | $task_info->save(); |
| 99 | Log::channel('inquiry')->error($task_id . '处理失败', [$e->getMessage(), $e->getFile(), $e->getLine()]); | 99 | Log::channel('inquiry')->error($task_id . '处理失败', [$e->getMessage(), $e->getFile(), $e->getLine()]); |
| 100 | - $this->output('任务失败:' . $e->getMessage()); | 100 | + $this->output('任务失败:' . $e->getMessage() . $e->getFile() . $e->getLine()); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | $use_time = time() - $time; | 103 | $use_time = time() - $time; |
| @@ -245,4 +245,41 @@ class Arr extends \Illuminate\Support\Arr | @@ -245,4 +245,41 @@ class Arr extends \Illuminate\Support\Arr | ||
| 245 | }, $arr)); | 245 | }, $arr)); |
| 246 | return json_encode(array_values(array_unique(array_filter($array)))); | 246 | return json_encode(array_values(array_unique(array_filter($array)))); |
| 247 | } | 247 | } |
| 248 | + | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * 数组转文本html数组 | ||
| 252 | + * @param $array | ||
| 253 | + * @param $indentLevel | ||
| 254 | + * @return array | ||
| 255 | + * @author zbj | ||
| 256 | + * @date 2025/9/26 | ||
| 257 | + */ | ||
| 258 | + public static function formatForHtml($array, $indentLevel = 0) { | ||
| 259 | + $result = []; | ||
| 260 | + $indent = str_repeat(' ', $indentLevel); | ||
| 261 | + | ||
| 262 | + foreach ($array as $key => $value) { | ||
| 263 | + $isNumericKey = is_numeric($key); | ||
| 264 | + | ||
| 265 | + if (is_array($value)) { | ||
| 266 | + if (!$isNumericKey) { | ||
| 267 | + $result[] = "{$indent}{$key}:<br/>"; | ||
| 268 | + $nestedResult = self::formatForHtml($value, $indentLevel + 1); | ||
| 269 | + } else { | ||
| 270 | + $key && $result[] = '<br/>'; | ||
| 271 | + $nestedResult = self::formatForHtml($value, $indentLevel); | ||
| 272 | + } | ||
| 273 | + $result = array_merge($result, $nestedResult); | ||
| 274 | + } else { | ||
| 275 | + if ($isNumericKey) { | ||
| 276 | + $result[] = "{$indent}{$value}<br/>"; | ||
| 277 | + } else { | ||
| 278 | + $result[] = "{$indent}{$key}: {$value}<br/>"; | ||
| 279 | + } | ||
| 280 | + } | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + return $result; | ||
| 284 | + } | ||
| 248 | } | 285 | } |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models\Inquiry; | 3 | namespace App\Models\Inquiry; |
| 4 | 4 | ||
| 5 | +use App\Helper\Arr; | ||
| 5 | use App\Helper\FormGlobalsoApi; | 6 | use App\Helper\FormGlobalsoApi; |
| 6 | use App\Models\Base; | 7 | use App\Models\Base; |
| 7 | use App\Utils\LogUtils; | 8 | use App\Utils\LogUtils; |
| @@ -83,6 +84,12 @@ class InquiryFormData extends Base | @@ -83,6 +84,12 @@ class InquiryFormData extends Base | ||
| 83 | $v = getImageUrl($v['path']); | 84 | $v = getImageUrl($v['path']); |
| 84 | $data[$k] = $v; | 85 | $data[$k] = $v; |
| 85 | } | 86 | } |
| 87 | + if(is_string($v)){ | ||
| 88 | + $arr = json_decode($v, true); | ||
| 89 | + if(is_array($arr)){ | ||
| 90 | + $v = implode('', Arr::formatForHtml($arr)); | ||
| 91 | + } | ||
| 92 | + } | ||
| 86 | //其他字段补充到message里 | 93 | //其他字段补充到message里 |
| 87 | if(!in_array($k, ['name', 'email', 'message', 'phone', 'ip', 'date', 'cname', 'domain', 'edition', 'domain_host_url'])){ | 94 | if(!in_array($k, ['name', 'email', 'message', 'phone', 'ip', 'date', 'cname', 'domain', 'edition', 'domain_host_url'])){ |
| 88 | $data['message'].= "<br/>" . $k .': ' . $v; | 95 | $data['message'].= "<br/>" . $k .': ' . $v; |
-
请 注册 或 登录 后发表评论