正在显示
1 个修改的文件
包含
21 行增加
和
14 行删除
@@ -101,7 +101,7 @@ class SyncToEsCmd { | @@ -101,7 +101,7 @@ class SyncToEsCmd { | ||
101 | $is_check_body = true; | 101 | $is_check_body = true; |
102 | } | 102 | } |
103 | 103 | ||
104 | - | 104 | + |
105 | $doc_id = ''; | 105 | $doc_id = ''; |
106 | try { | 106 | try { |
107 | $data = $this->db->throw()->first(\Model\listsSql::first('`id` = '.$id)); | 107 | $data = $this->db->throw()->first(\Model\listsSql::first('`id` = '.$id)); |
@@ -230,19 +230,10 @@ class SyncToEsCmd { | @@ -230,19 +230,10 @@ class SyncToEsCmd { | ||
230 | unset($data['from_name']); | 230 | unset($data['from_name']); |
231 | unset($data['date']); | 231 | unset($data['date']); |
232 | 232 | ||
233 | - if(!empty($data['to_name']) && strlen($data['to_name'])>10000){ | ||
234 | - $data['to_name'] = @json_decode($data['to_name'],true); | ||
235 | - if(is_array($data['to_name'])){ | ||
236 | - $data['to_name'] = array_map(function ($v){ | ||
237 | - $v['name'] = ''; | ||
238 | - return $v; | ||
239 | - },$data['to_name']); | ||
240 | - $data['to_name'] = array_slice($data['to_name'],0,100); | ||
241 | - $data['to_name'] = json_encode($data['to_name']); | ||
242 | - }else{ | ||
243 | - $data['to_name'] = ''; | ||
244 | - } | ||
245 | - } | 233 | + $data['to_name'] = $this->trimEmail($data['to_name']??[]); |
234 | + $data['cc'] = $this->trimEmail($data['cc']??[]); | ||
235 | + $data['bcc'] = $this->trimEmail($data['bcc']??[]); | ||
236 | + | ||
246 | $data['description'] = str_replace(["\n"],"",$data['description']); | 237 | $data['description'] = str_replace(["\n"],"",$data['description']); |
247 | // unset($data['to_name']); | 238 | // unset($data['to_name']); |
248 | 239 | ||
@@ -257,6 +248,22 @@ class SyncToEsCmd { | @@ -257,6 +248,22 @@ class SyncToEsCmd { | ||
257 | } | 248 | } |
258 | 249 | ||
259 | 250 | ||
251 | + private function trimEmail($emails){ | ||
252 | + if($emails){ | ||
253 | + $emails = is_array($emails) ? $emails : @json_decode($emails,true); | ||
254 | + if(is_array($emails) && count($emails)>100){ | ||
255 | + | ||
256 | + $emails = array_map(function ($v){ | ||
257 | + $v['name'] = ''; | ||
258 | + return $v; | ||
259 | + },$emails); | ||
260 | + $emails = array_slice($emails,0,100); | ||
261 | + return json_encode($emails); | ||
262 | + } | ||
263 | + } | ||
264 | + return ''; | ||
265 | + } | ||
266 | + | ||
260 | } | 267 | } |
261 | 268 | ||
262 | (new SyncToEsCmd())->handler(); | 269 | (new SyncToEsCmd())->handler(); |
-
请 注册 或 登录 后发表评论