Commit 8df939bd authored by 刘小敏's avatar 刘小敏

3D试戴消息通知完善

parent 86180074
......@@ -193,7 +193,7 @@ class AiVideoGen extends BaseJob
$this->debug_log('[AI视频]保存本地视频成功 sql: '.db()->getLastSql());
// ========== 新增:发送消息通知 ==========
// $this->sendNotification($user_id, config('shopro.api_host').$video_url);
$this->sendNotification($user_id, $taskid);
// 删除队列job
$this->debug_log('[AI视频]删除Job');
......@@ -267,7 +267,7 @@ class AiVideoGen extends BaseJob
/**
* 发送AI视频生成成功通知
*/
private function sendNotification($user_id, $video_url)
private function sendNotification($user_id, $taskid)
{
try {
// 获取用户信息
......@@ -279,14 +279,17 @@ class AiVideoGen extends BaseJob
// 获取AI试戴记录
$aiTryon = AiTryOnModel::where('user_id', $user_id)
->where('ai_url', $video_url)
->where('ai_task_id', $taskid)
->find();
// 发送通知
NotificationFacade::send($user, new AiVideoSuccess([
'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [],
'user' => $user->toArray()
]));
$user = User::where('id', $user_id)->find();
$user && $user->notify(
new AiVideoSuccess([
'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [],
'user' => $user->toArray()
])
);
$this->debug_log('[AI视频通知]通知发送成功: user_id=' . $user_id);
return true;
......
......@@ -24,6 +24,9 @@ trait Notification
// 活动
\addons\shopro\notification\activity\GrouponFail::class,
\addons\shopro\notification\activity\GrouponFinish::class,
// AI试戴
\addons\shopro\notification\ai\AiVideoSuccess::class,
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment