Commit 49793a7e authored by 刘小敏's avatar 刘小敏

3D试戴消息通知 调试

parent 8df939bd
...@@ -124,11 +124,18 @@ class AiVideoGen extends BaseJob ...@@ -124,11 +124,18 @@ class AiVideoGen extends BaseJob
*/ */
public function save(Job $job, $data) public function save(Job $job, $data)
{ {
try { try {
$taskid = $data['taskid']; $taskid = $data['taskid'];
$user = $data['user']; $user = $data['user'];
$user_id = isset($user['id']) ? $user['id'] : 0; $user_id = isset($user['id']) ? $user['id'] : 0;
$this->debug_log('***************************** 保存AI视频脚本开始 userid '.$user_id.' taskid:'.$taskid.' ***********************************'.PHP_EOL); $this->debug_log('***************************** '.date('Y-m-d H:i:s'). '保存AI视频脚本开始 userid '.$user_id.' taskid:'.$taskid.' ***********************************'.PHP_EOL);
$this->sendNotification($user_id, $taskid);
// 删除队列job
$this->debug_log('[AI视频]删除Job');
$job->delete();
exit;
if (!isset($taskid) || empty($taskid) || !isset($user_id) || empty($user_id)) { if (!isset($taskid) || empty($taskid) || !isset($user_id) || empty($user_id)) {
...@@ -283,18 +290,21 @@ class AiVideoGen extends BaseJob ...@@ -283,18 +290,21 @@ class AiVideoGen extends BaseJob
->find(); ->find();
// 发送通知 // 发送通知
$user = User::where('id', $user_id)->find(); // $user = User::where('id', $user_id)->find();
print_r($aiTryon->toArray());
print_r($user->toArray());
$user && $user->notify( $user && $user->notify(
new AiVideoSuccess([ new AiVideoSuccess([
'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [], 'ai_tryon' => $aiTryon ? $aiTryon->toArray() : [],
'user' => $user->toArray() 'user' => $aiTryon ? $user->toArray() : []
]) ])
); );
$this->debug_log('[AI视频通知]通知发送成功: user_id=' . $user_id); $this->debug_log('[AI视频]通知发送成功: user_id=' . $user_id . ' taskid=' . $taskid);
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->debug_log('[AI视频通知]发送失败: user_id=' . $user_id . ' ' . $e->getMessage()); $this->debug_log('[AI视频]通知发送失败: user_id=' . $user_id . ' taskid=' . $taskid . ' ' . $e->getMessage());
return false; return false;
} }
} }
......
...@@ -59,7 +59,17 @@ class AiVideoSuccess extends Notification ...@@ -59,7 +59,17 @@ class AiVideoSuccess extends Notification
[ [
"name" => "生成时间", "name" => "生成时间",
"field" => "create_time", "field" => "create_time",
"template_field" => "time2", "template_field" => "time3",
],
[
"name" => "试戴结果",
"field" => "ai_err_msg",
"template_field" => "phrase2",
],
[
"name" => "商品名称",
"field" => "goods_title",
"template_field" => "thing1",
] ]
], ],
] ]
...@@ -76,6 +86,8 @@ class AiVideoSuccess extends Notification ...@@ -76,6 +86,8 @@ class AiVideoSuccess extends Notification
['name' => '视频链接', 'field' => 'video_url'], ['name' => '视频链接', 'field' => 'video_url'],
['name' => '用户昵称', 'field' => 'nickname'], ['name' => '用户昵称', 'field' => 'nickname'],
['name' => '用户手机', 'field' => 'mobile'], ['name' => '用户手机', 'field' => 'mobile'],
['name' => '试戴结果', 'field' => 'ai_err_msg'],
['name' => '商品名称', 'field' => 'goods_title'],
] ]
]; ];
...@@ -92,13 +104,15 @@ class AiVideoSuccess extends Notification ...@@ -92,13 +104,15 @@ class AiVideoSuccess extends Notification
$data['template'] = $this->returnField['name']; $data['template'] = $this->returnField['name'];
$data['status'] = '生成成功'; $data['status'] = '生成成功';
$data['create_time'] = date('Y-m-d H:i:s'); $data['create_time'] = date('Y-m-d H:i:s', $aiTryon['create_time']);
$data['video_url'] = $aiTryon['ai_url'] ?? ''; $data['video_url'] = $aiTryon['ai_url'] ?? '';
$data['goods_title'] = $aiTryon['goods_title'] ?? '';
$data['ai_err_msg'] = $aiTryon['ai_err_msg'] ?? '';
$data['nickname'] = $user['nickname'] ?? ''; $data['nickname'] = $user['nickname'] ?? '';
$data['mobile'] = $user['mobile'] ?? ''; $data['mobile'] = $user['mobile'] ?? '';
// 小程序跳转地址 // 小程序跳转地址
$data['jump_url'] = "/pages/user/tryOnRecord"; $data['jump_url'] = "pages/user/tryOnRecord";
return $data; return $data;
} }
......
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