Merge branch 'develop' into feature/mzl_dev
This commit is contained in:
@@ -126,9 +126,14 @@ class Util
|
|||||||
|
|
||||||
public static function mask($str)
|
public static function mask($str)
|
||||||
{
|
{
|
||||||
|
$length = strlen($str);
|
||||||
|
|
||||||
if(empty($str)){
|
if(empty($str)){
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
if($length <= 6){
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
return substr($str, 0, 3) . '****' . substr($str, -4);
|
return substr($str, 0, 3) . '****' . substr($str, -4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace app\ticket\service;
|
namespace app\ticket\service;
|
||||||
|
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
|
use app\common\service\MessageNotificationsService;
|
||||||
use app\common\service\OssService;
|
use app\common\service\OssService;
|
||||||
use app\ticket\logic\CategorieLogic;
|
use app\ticket\logic\CategorieLogic;
|
||||||
use app\ticket\logic\ConversationLogic;
|
use app\ticket\logic\ConversationLogic;
|
||||||
@@ -54,43 +55,47 @@ class ConversationService
|
|||||||
$ticket = (new TicketLogic())->find($data['ticket_id']);
|
$ticket = (new TicketLogic())->find($data['ticket_id']);
|
||||||
$categorie= (new CategorieLogic())->find($ticket['categorie_id']);
|
$categorie= (new CategorieLogic())->find($ticket['categorie_id']);
|
||||||
$categorieName = isset($categorie['translation']) ? $categorie['translation']['name'] : '';
|
$categorieName = isset($categorie['translation']) ? $categorie['translation']['name'] : '';
|
||||||
|
|
||||||
$notice = [
|
$userDefault = [1, 75, 78];
|
||||||
'code' => $ticket['code'],
|
$tiket_content = $ticket['content'];
|
||||||
'category' => $categorieName,
|
if (empty($conversation)) { //没有沟通记录
|
||||||
'content' => $data['content'],
|
$title = '新工单提醒-'.$categorieName;
|
||||||
'reply' => '',
|
$notice_user_id = $userDefault;
|
||||||
];
|
|
||||||
//$emailDefault = 'app@hnxinyouhe.com'; //公共邮箱
|
|
||||||
//$emailDefault = 'support@hnxinyouhe.com'; //公共邮箱
|
|
||||||
$emailDefault = env('TICKET_EMAIL_DEFAULT');
|
|
||||||
if (empty($conversation)) {
|
|
||||||
$email = $emailDefault;
|
|
||||||
}else{
|
}else{
|
||||||
|
$title = '工单回复';
|
||||||
$tiket = (new TicketLogic())->find($conversation['ticket_id']);
|
$tiket = (new TicketLogic())->find($conversation['ticket_id']);
|
||||||
if($data['user_id'] != $tiket['user_id']){
|
if($data['user_id'] != $tiket['user_id']){
|
||||||
$email = User::where('id',$tiket['user_id'])->value('email');
|
$notice_user_id = [$tiket['user_id']];
|
||||||
}else{
|
}else{
|
||||||
$conversationLast = Conversation::where('ticket_id', '=', $conversation['ticket_id'])
|
$conversationLast = Conversation::where('ticket_id', '=', $conversation['ticket_id'])
|
||||||
->where('user_id', '!=', $data['user_id'])
|
->where('user_id', '!=', $data['user_id'])
|
||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$email = (!empty($conversationLast['user_id']))?User::where('id',$conversationLast['user_id'])->value('email',$emailDefault):$emailDefault;
|
$notice_user_id = (!empty($conversationLast['user_id']))? [$conversationLast['user_id']]:$userDefault;
|
||||||
}
|
}
|
||||||
$notice['content'] = $tiket['content'];
|
$tiket_content = $tiket['content'];
|
||||||
|
|
||||||
$status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS));
|
$status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS));
|
||||||
$locale = locale();
|
$locale = locale();
|
||||||
$ticket_status = $locale == 'zh'? Constants::TICKET_STATUS_ZH:Constants::TICKET_STATUS_EN;
|
$ticket_status = $locale == 'zh'? Constants::TICKET_STATUS_ZH:Constants::TICKET_STATUS_EN;
|
||||||
$content = str_replace($status_fanyi,$ticket_status,$data['content']);
|
$content = str_replace($status_fanyi,$ticket_status,$data['content']);
|
||||||
|
|
||||||
$notice['reply'] = '<li>最新回复:' . $content . '</li>';
|
$reply = $content?($content.'\n'.'工单内容:'):'' ;
|
||||||
}
|
|
||||||
if(!empty($emailDefault)){
|
|
||||||
\app\common\utils\email\MailSend::send($email, '【XYH】新的工单提醒', replaceTpl($notice, 'work_order'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$notice = ['sender_id' => 0, //发送人ID 0默认系统
|
||||||
|
'sender_type' => 'system', //发送者类型 user admin system
|
||||||
|
'title' => $title, //标题
|
||||||
|
'content' => ($reply??'') . $tiket_content, //内容
|
||||||
|
'scene' => 1, //场景 0系统公共 1系统通知
|
||||||
|
'recipient' => $notice_user_id, //接收人 空为全部
|
||||||
|
'push_method' => 0 //推送方式0系统推送1手动推送
|
||||||
|
];
|
||||||
|
|
||||||
|
// 异步推送
|
||||||
|
\Webman\RedisQueue\Redis::send('notice', $notice);
|
||||||
|
|
||||||
unset($data['categorie_id']);
|
unset($data['categorie_id']);
|
||||||
unset($data['code']);
|
unset($data['code']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user