切换导航条
此项目
正在载入...
登录
周海龙
/
mail-serve
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
9 months ago
提交
b174a0f9c9cea6da2ee7915dcf47eccd55e62e95
1 个父辈
15e34d29
x
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
72 行增加
和
29 行删除
controller/fob_ai/MailList.php
lib/App.php
controller/fob_ai/MailList.php
查看文件 @
b174a0f
...
...
@@ -201,6 +201,9 @@ class MailList extends Base {
public
function
count
(){
$emails
=
$this
->
getEmails
(
'id'
);
// show_count_filed
$show_count_filed
=
app
()
->
requestArr
(
'show_count_filed'
,[
'inbox'
,
'send'
,
'unseen'
,
'flagged'
,
'junk'
,
'hot_inbox'
,
'hot_send'
]);
$sql
=
"select count(*) from `lists` left join `fob_hot_mail` on `lists`.`id` = `fob_hot_mail`.`lists_id` where "
;
$where
=
[
'lists|email_id'
=>
$emails
];
...
...
@@ -209,43 +212,58 @@ class MailList extends Base {
$where
[
'from.notin'
]
=
$this
->
from_not_in
();
if
(
!
$where
[
'from.notin'
])
unset
(
$where
[
'from.notin'
]);
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'发件箱'
);
// 预热发件箱
$where
[
'fob_hot_mail|folder'
]
=
'f'
;
$fCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
// 预热收件箱
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'收件箱'
);
$where
[
'fob_hot_mail|folder'
]
=
's'
;
$sCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
// 发件箱
if
(
in_array
(
'hot_send'
,
$show_count_filed
)){
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'发件箱'
);
// 预热发件箱
$where
[
'fob_hot_mail|folder'
]
=
'f'
;
$fCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
// 预热收件箱
if
(
in_array
(
'hot_inbox'
,
$show_count_filed
))
{
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'收件箱'
);
$where
[
'fob_hot_mail|folder'
]
=
's'
;
$sCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
unset
(
$where
[
'fob_hot_mail|folder'
]);
$sql
=
$sql
.
" ISNULL(`lists_id`) and "
;
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'发件箱'
);
$faCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
if
(
in_array
(
'send'
,
$show_count_filed
))
{
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'发件箱'
);
$faCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
// 垃圾箱
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'垃圾箱'
);
$lajiCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
if
(
in_array
(
'junk'
,
$show_count_filed
))
{
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'垃圾箱'
);
$lajiCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
// 收件箱
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'收件箱'
);
$shouCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
if
(
in_array
(
'inbox'
,
$show_count_filed
))
{
$where
[
'lists|folder_id'
]
=
$this
->
getFolderId
(
'收件箱'
);
$shouCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
// 未读
$where
[
'seen'
]
=
0
;
$seenCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
unset
(
$where
[
'seen'
]);
if
(
in_array
(
'unseen'
,
$show_count_filed
))
{
$where
[
'seen'
]
=
0
;
$seenCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
unset
(
$where
[
'seen'
]);
}
// 星标
$where
[
'flagged'
]
=
1
;
$flaggedCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
app
()
->
_json
([
'inbox'
=>
$shouCount
,
'send'
=>
$faCount
,
'unseen'
=>
$seenCount
,
'flagged'
=>
$flaggedCount
,
'junk'
=>
$lajiCount
,
'hot_inbox'
=>
$sCount
,
'hot_send'
=>
$fCount
,
]);
if
(
in_array
(
'flagged'
,
$show_count_filed
))
{
$where
[
'flagged'
]
=
1
;
$flaggedCount
=
db
()
->
count
(
$sql
.
dbWhere
(
$where
));
}
$data
=
[];
if
(
isset
(
$shouCount
))
$data
[
'inbox'
]
=
$shouCount
;
if
(
isset
(
$faCount
))
$data
[
'send'
]
=
$faCount
;
if
(
isset
(
$seenCount
))
$data
[
'unseen'
]
=
$seenCount
;
if
(
isset
(
$flaggedCount
))
$data
[
'flagged'
]
=
$flaggedCount
;
if
(
isset
(
$lajiCount
))
$data
[
'junk'
]
=
$lajiCount
;
if
(
isset
(
$sCount
))
$data
[
'hot_inbox'
]
=
$sCount
;
if
(
isset
(
$fCount
))
$data
[
'hot_send'
]
=
$fCount
;
app
()
->
_json
(
$data
);
}
...
...
lib/App.php
查看文件 @
b174a0f
...
...
@@ -191,6 +191,31 @@ class App {
}
/**
* 读取数组
* @param string $name
* @param array $default
* @param null $filter
* @return array|float|int|mixed|string[]
* @author:dc
* @time 2024/8/6 9:36
*/
public
function
requestArr
(
$name
=
'*'
,
array
$default
=
[],
$filter
=
null
){
$value
=
$this
->
request
(
$name
,
$default
,
$filter
);
if
(
!
is_array
(
$value
)){
$value
=
explode
(
','
,
$value
);
}
foreach
(
$value
as
$k
=>
$v
){
if
(
$v
===
''
){
unset
(
$value
[
$k
]);
}
}
if
(
!
$value
){
return
$default
;
}
return
$value
;
}
/**
* 是否存在
* @param string $name
* @return bool
...
...
请
注册
或
登录
后发表评论