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

3D试戴消息通知完善

parent 86180074
...@@ -193,7 +193,7 @@ class AiVideoGen extends BaseJob ...@@ -193,7 +193,7 @@ class AiVideoGen extends BaseJob
$this->debug_log('[AI视频]保存本地视频成功 sql: '.db()->getLastSql()); $this->debug_log('[AI视频]保存本地视频成功 sql: '.db()->getLastSql());
// ========== 新增:发送消息通知 ========== // ========== 新增:发送消息通知 ==========
// $this->sendNotification($user_id, config('shopro.api_host').$video_url); $this->sendNotification($user_id, $taskid);
// 删除队列job // 删除队列job
$this->debug_log('[AI视频]删除Job'); $this->debug_log('[AI视频]删除Job');
...@@ -267,7 +267,7 @@ class AiVideoGen extends BaseJob ...@@ -267,7 +267,7 @@ class AiVideoGen extends BaseJob
/** /**
* 发送AI视频生成成功通知 * 发送AI视频生成成功通知
*/ */
private function sendNotification($user_id, $video_url) private function sendNotification($user_id, $taskid)
{ {
try { try {
// 获取用户信息 // 获取用户信息
...@@ -279,14 +279,17 @@ class AiVideoGen extends BaseJob ...@@ -279,14 +279,17 @@ class AiVideoGen extends BaseJob
// 获取AI试戴记录 // 获取AI试戴记录
$aiTryon = AiTryOnModel::where('user_id', $user_id) $aiTryon = AiTryOnModel::where('user_id', $user_id)
->where('ai_url', $video_url) ->where('ai_task_id', $taskid)
->find(); ->find();
// 发送通知 // 发送通知
NotificationFacade::send($user, new AiVideoSuccess([ $user = User::where('id', $user_id)->find();
'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [], $user && $user->notify(
'user' => $user->toArray() new AiVideoSuccess([
])); 'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [],
'user' => $user->toArray()
])
);
$this->debug_log('[AI视频通知]通知发送成功: user_id=' . $user_id); $this->debug_log('[AI视频通知]通知发送成功: user_id=' . $user_id);
return true; return true;
......
...@@ -24,6 +24,9 @@ trait Notification ...@@ -24,6 +24,9 @@ trait Notification
// 活动 // 活动
\addons\shopro\notification\activity\GrouponFail::class, \addons\shopro\notification\activity\GrouponFail::class,
\addons\shopro\notification\activity\GrouponFinish::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