Merge branch 'feature/ticket0807' into develop_bm
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\ticket\service;
|
namespace app\ticket\service;
|
||||||
|
|
||||||
|
use app\common\service\OssService;
|
||||||
use app\ticket\logic\ConversationLogic;
|
use app\ticket\logic\ConversationLogic;
|
||||||
use config\constants\Constants;
|
use config\constants\Constants;
|
||||||
use support\Db;
|
use support\Db;
|
||||||
@@ -19,8 +20,13 @@ class ConversationService
|
|||||||
$result = (new ConversationLogic())->list($params);
|
$result = (new ConversationLogic())->list($params);
|
||||||
|
|
||||||
$status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS));
|
$status_fanyi = array_map(fn($v) => "{{{$v}}}", array_flip(Constants::TICKET_STATUS));
|
||||||
|
$ossservice = new OssService();
|
||||||
foreach ($result as $key => $value) {
|
foreach ($result as $key => $value) {
|
||||||
$result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']);
|
$result[$key]['content'] = str_replace($status_fanyi,$ticket_status,$value['content']);
|
||||||
|
$result[$key]['attachment'] = explode(",", $value['attachment']);
|
||||||
|
foreach ($result[$key]['attachment'] as $k => $attachment) {
|
||||||
|
$result[$key]['attachment_full'][$k] = (!empty($attachment))?$ossservice->generatePrivateUrl($attachment):'';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -28,6 +34,7 @@ class ConversationService
|
|||||||
public function add(array $data)
|
public function add(array $data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$data['attachment'] = implode(",", $data['attachment']);
|
||||||
return (new ConversationLogic())->add($data);
|
return (new ConversationLogic())->add($data);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@@ -38,6 +45,7 @@ class ConversationService
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Db::beginTransaction();
|
Db::beginTransaction();
|
||||||
|
$data['attachment'] = implode(",", $data['attachment']);
|
||||||
$result = (new ConversationLogic())->edit($data);
|
$result = (new ConversationLogic())->edit($data);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\ticket\service;
|
namespace app\ticket\service;
|
||||||
|
|
||||||
|
use app\common\model\User;
|
||||||
use app\ticket\logic\AttachmentLogic;
|
use app\ticket\logic\AttachmentLogic;
|
||||||
use app\ticket\logic\ConversationLogic;
|
use app\ticket\logic\ConversationLogic;
|
||||||
use app\ticket\logic\TicketLogic;
|
use app\ticket\logic\TicketLogic;
|
||||||
@@ -28,6 +29,8 @@ class TicketService
|
|||||||
foreach ($v['attachments'] as &$attachments) {
|
foreach ($v['attachments'] as &$attachments) {
|
||||||
$attachments['storage_path_full'] = (new \app\common\service\OssService())->generatePrivateUrl($attachments['storage_path']);
|
$attachments['storage_path_full'] = (new \app\common\service\OssService())->generatePrivateUrl($attachments['storage_path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res[$k]['user_name'] = User::where('id', $v['user_id'])->value('name');
|
||||||
}
|
}
|
||||||
unset($v);
|
unset($v);
|
||||||
unset($attachments);
|
unset($attachments);
|
||||||
@@ -45,10 +48,12 @@ class TicketService
|
|||||||
(new AttachmentLogic())->adds($attachment, $result->id, $data['user_id']);
|
(new AttachmentLogic())->adds($attachment, $result->id, $data['user_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cleanContent = trim(preg_replace('/\s+/', ' ', strip_tags($data['content'] ?? '')));
|
||||||
$conversation = [
|
$conversation = [
|
||||||
'ticket_id' => $result->id,
|
'ticket_id' => $result->id,
|
||||||
'content' => $data['content'],
|
'content' => $cleanContent,
|
||||||
'user_id' => $data['user_id'],
|
'user_id' => $data['user_id'],
|
||||||
|
'attachment' => implode(",", $data['attachment']),
|
||||||
];
|
];
|
||||||
(new ConversationService())->add($conversation);
|
(new ConversationService())->add($conversation);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user