切换导航条
此项目
正在载入...
登录
周海龙
/
mail-serve
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
邓超
2 years ago
提交
397eec5daca7a15c90cd596b58dfd8c09171798b
1 个父辈
67fa337a
1
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
76 行增加
和
7 行删除
controller/Home.php
function.php
lang/zh.php
model/emailSql.php
route.php
controller/Home.php
查看文件 @
397eec5
...
...
@@ -5,6 +5,7 @@ namespace Controller;
use
Lib\Mail\MailFun
;
use
Model\emailSql
;
use
Model\listsSql
;
use
function
Swoole
\Coroutine\Http\request
;
/**
* @author:dc
...
...
@@ -50,6 +51,50 @@ class Home extends Base {
}
/**
* 收到前端的同步请求操作
* @author:dc
* @time 2023/3/10 10:38
*/
public
function
sync
(){
$emails
=
app
()
->
request
(
'emails'
);
if
(
empty
(
$emails
)){
$tokens
=
app
()
->
request
(
'tokens'
);
$tokens
=
is_array
(
$tokens
)
?
$tokens
:
[
$tokens
];
foreach
(
$tokens
as
$k
=>
$token
){
if
(
!
preg_match
(
'/^[0-9a-zA-Z]{32}$/'
,
$token
)){
unset
(
$tokens
[
$k
]);
}
}
if
(
!
empty
(
$tokens
)){
$where
[
'token'
]
=
array_values
(
$tokens
);
}
}
else
{
$emails
=
is_array
(
$emails
)
?
$emails
:
[
$emails
];
foreach
(
$emails
as
$k
=>
$email
){
if
(
!
preg_match
(
'/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/'
,
$email
)){
unset
(
$emails
[
$k
]);
}
}
if
(
!
empty
(
$emails
)){
$where
[
'email'
]
=
array_values
(
$emails
);
}
}
if
(
empty
(
$where
)){
app
()
->
e
(
'sync_request_param_error'
);
}
else
{
// 查询id
$ids
=
db
()
->
all
(
emailSql
::
getValues
(
$where
));
foreach
(
$ids
as
$v
){
redis
()
->
rPush
(
'sync_email_lists'
,
$v
[
'id'
]);
}
// 返回成功的参数值
app
()
->
_json
(
array_values
(
$where
));
}
}
...
...
function.php
查看文件 @
397eec5
...
...
@@ -258,7 +258,7 @@ function list_to_tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0,$em
* @author:dc
* @time 2023/2/18 11:04
*/
function
start_now_mail
(
$email
=
null
){
function
start_now_mail
(){
$id
=
0
;
while
(
true
){
...
...
lang/zh.php
查看文件 @
397eec5
...
...
@@ -25,4 +25,6 @@ return [
'folder_tree_max_two'
=>
'文件夹最多2级'
,
'folder_is_exist'
=>
'文件夹已存在'
,
'sync_request_param_error'
=>
'同步请求参数异常'
,
];
\ No newline at end of file
...
...
model/emailSql.php
查看文件 @
397eec5
...
...
@@ -66,6 +66,17 @@ class emailSql {
];
}
/**
* 获取字段值
* @param $where
* @param string $field
* @return string
* @author:dc
* @time 2023/3/10 10:46
*/
public
static
function
getValues
(
$where
,
$field
=
'id'
){
return
"select `
{
$field
}
` from `"
.
static
::
$table
.
"` where "
.
dbWhere
(
$where
);
}
...
...
route.php
查看文件 @
397eec5
...
...
@@ -29,42 +29,53 @@ return [
* @param string _token_ token登录凭证
* @param int page 当前页数
*/
'
mail/
list'
=>
[
\Controller\Home
::
class
,
'lists'
],
'list'
=>
[
\Controller\Home
::
class
,
'lists'
],
/**
* 邮件文件夹
* @see \Controller\Folder::lists()
* @param string _token_ token登录凭证
*/
'
mail/
folder'
=>
[
\Controller\Folder
::
class
,
'lists'
],
'folder'
=>
[
\Controller\Folder
::
class
,
'lists'
],
/**
* 邮件/创建文件夹
* @see \Controller\Folder::create()
* @param string _token_ token登录凭证
*/
'
mail/
folder/create'
=>
[
\Controller\Folder
::
class
,
'create'
],
'folder/create'
=>
[
\Controller\Folder
::
class
,
'create'
],
/**
* 邮件/重命名文件夹
* @see \Controller\Folder::rename()
* @param string _token_ token登录凭证
*/
'
mail/
folder/rename'
=>
[
\Controller\Folder
::
class
,
'rename'
],
'folder/rename'
=>
[
\Controller\Folder
::
class
,
'rename'
],
/**
* 邮件/删除文件夹
* @see \Controller\Folder::delete()
* @param string _token_ token登录凭证
*/
'
mail/
folder/delete'
=>
[
\Controller\Folder
::
class
,
'delete'
],
'folder/delete'
=>
[
\Controller\Folder
::
class
,
'delete'
],
/**
* 发送邮件
* @see \Controller\Home::send_mail()
* @param string _token_ token登录凭证
*/
'mail/send'
=>
[
\Controller\Home
::
class
,
'send_mail'
],
'send'
=>
[
\Controller\Home
::
class
,
'send_mail'
],
/**
* 同步请求
* @see \Controller\Home::sync()
* @param string _token_ token登录凭证
*/
'sync'
=>
[
\Controller\Home
::
class
,
'sync'
],
];
...
...
请
注册
或
登录
后发表评论