正在显示
1 个修改的文件
包含
3 行增加
和
38 行删除
1 | <?php | 1 | <?php |
2 | -namespace App\Mail\lib; | 2 | +namespace Helper\Mail; |
3 | 3 | ||
4 | + | ||
5 | +use Illuminate\Support\Facades\Storage; | ||
4 | use PHPMailer\PHPMailer\PHPMailer; | 6 | use PHPMailer\PHPMailer\PHPMailer; |
5 | use PHPMailer\PHPMailer\SMTP; | 7 | use PHPMailer\PHPMailer\SMTP; |
6 | 8 | ||
@@ -12,43 +14,6 @@ use PHPMailer\PHPMailer\SMTP; | @@ -12,43 +14,6 @@ use PHPMailer\PHPMailer\SMTP; | ||
12 | */ | 14 | */ |
13 | class MailFun { | 15 | class MailFun { |
14 | 16 | ||
15 | - /** | ||
16 | - * 列表 转 树数据 | ||
17 | - * @param $list | ||
18 | - * @param string $pk | ||
19 | - * @param string $pid | ||
20 | - * @param string $child | ||
21 | - * @param int $root | ||
22 | - * @param bool $empty_child | ||
23 | - * @return array | ||
24 | - * @time 2022/8/1 16:05 | ||
25 | - */ | ||
26 | - public static function list2Tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0, $empty_child=true) { | ||
27 | - // 创建Tree | ||
28 | - $tree = array(); | ||
29 | - if(is_array($list)) { | ||
30 | - // 创建基于主键的数组引用 | ||
31 | - $refer = array(); | ||
32 | - foreach ($list as $key => $data) { | ||
33 | - if($empty_child){ | ||
34 | - $list[$key][$child] = []; | ||
35 | - } | ||
36 | - $refer[$data[$pk]] = &$list[$key]; | ||
37 | - } | ||
38 | - foreach ($list as $key => $data) { | ||
39 | - // 判断是否存在parent | ||
40 | - $parentId = $data[$pid]; | ||
41 | - if ($root == $parentId) { | ||
42 | - $tree[] = &$list[$key]; | ||
43 | - }else{ | ||
44 | - if (isset($refer[$parentId])) { | ||
45 | - $refer[$parentId][$child][] = &$list[$key]; | ||
46 | - } | ||
47 | - } | ||
48 | - } | ||
49 | - } | ||
50 | - return $tree; | ||
51 | - } | ||
52 | 17 | ||
53 | /** | 18 | /** |
54 | * json encode | 19 | * json encode |
-
请 注册 或 登录 后发表评论