作者 邓超

1

... ... @@ -9,6 +9,7 @@
"ext-redis": "*",
"ext-mbstring": "*",
"ext-json": "*",
"ext-iconv": "*",
"phpmailer/phpmailer": "^6.7"
},
"require-dev": {
... ...
... ... @@ -49,7 +49,7 @@ class App {
* 输出到前端的数据
* @var mixed
*/
private mixed $data;
private mixed $data = [];
/**
* 表单文件
... ... @@ -274,16 +274,26 @@ class App {
}
/**
* @param $data
* @param int $http_code
* @author:dc
* @time 2023/3/27 10:53
*/
public static function echo($data, $http_code = 200){
if(php_sapi_name()=='cli'){
return $data;
}
http_response_code($http_code);
if(is_array($data)){
header("Content-Type:application/json;Charset=UTF-8;");
@header("Content-Type:application/json;Charset=UTF-8;");
echo json_encode($data,JSON_UNESCAPED_UNICODE);
}else{
header("Content-Type:text/html;Charset=UTF-8;");
@header("Content-Type:text/html;Charset=UTF-8;");
echo $data;
}
}
... ...
... ... @@ -617,8 +617,9 @@ class Imap {
foreach($matches as $match){
$match[2] = str_replace(['_(_(_(_0_)_)_)_'],[':'],$match[2]);
if(strpos($match[2],'=?')!==false){
$match2=iconv_mime_decode($match[2],ICONV_MIME_DECODE_CONTINUE_ON_ERROR,'utf-8');
$match[2] = $match2;
$match[2] = mb_decode_mimeheader($match[2]);
// $match2=iconv_mime_decode($match[2],ICONV_MIME_DECODE_CONTINUE_ON_ERROR,'utf-8');
// if($match2) $match[2] = $match2;
}
if(isset($headers[$match[1]]) && is_array($headers[$match[1]])){
... ...
... ... @@ -317,18 +317,28 @@ class Mail {
$body = $body[0]['RFC822.TEXT']??'';
if(!empty($body)){
$db->insert(bodySql::$table,[
'lists_id' => $id,
'text_html' => base64_encode(json_encode($body)) // todo::因为邮件会出现多编码问题,会导致数据库写不进去
],false);
$description = '';
foreach ($body as $item){
if(in_array($item['type'],['text/html','text/plain'])){
foreach ($body as $key=>$item){
if(!$description && in_array($item['type'],['text/html','text/plain'])){
$description = mb_substr(trim(strip_tags($item['body'])),0,190);
break;
}
if(!empty($body[$key]['body'])){
$body[$key]['body'] = base64_encode($body[$key]['body']);
}
}
try {
$db->insert(bodySql::$table,[
'lists_id' => $id,
'text_html' => $body // todo::因为邮件会出现多编码问题,会导致数据库写不进去
],false);
}catch (\Throwable $e){
$db->update(bodySql::$table,[
'text_html' => $body // todo::因为邮件会出现多编码问题,会导致数据库写不进去
],dbWhere(['lists_id' => $id]),false);
}
// 更新描述
$db->update(listsSql::$table,[
'description' => $description
... ...