Commit 57a6c175 authored by 刘小敏's avatar 刘小敏

3D试戴订阅消息优化

parent b31b06e8
......@@ -81,6 +81,12 @@ class AiTryon extends Common
$user = auth_user();
//开发过程中临时调试代码
\think\Queue::push('\addons\shopro\job\AiImgGen@exec', ['user' => $user->toArray(), 'id' => 245 ], 'shopro-high');
$this->success('推送队列成功777');
exit;
// $this->success('图片生成成功', 'https://zhubaoshop.sydggxs.com/uploads/20260508/c92396f646bd41887329891647fcfcaf.png');
// 校验商品分类是否在允许试戴分类中
$goodsService = new GoodsService();
$is_allowed = $goodsService->isCategoryAllowed('', $params['goods_id']);
......@@ -89,9 +95,6 @@ class AiTryon extends Common
$this->error('商品所属分类不允许试戴');
}
//开发过程中临时代码,AI图片生成次数有限
// $this->success('图片生成成功', 'https://zhubaoshop.sydggxs.com/uploads/20260508/c92396f646bd41887329891647fcfcaf.png');
// 校验试戴次数 && 扣除积分
$userService = new User();
$res = $userService->isTry($user->id);
......@@ -118,6 +121,7 @@ class AiTryon extends Common
'ai_type' => 0,
'ai_status' => 0,
'ai_url' => '',
'createtime' => time()
];
$id = $tryonModel->insertGetId($tryonData);
......@@ -169,6 +173,12 @@ class AiTryon extends Common
$user = auth_user();
//开发过程中临时调试代码
// \think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => 'cgt-20260518151431-zcrgp', 'user' => $user, 'id'=> 214], 'shopro-high');
// $this->success('推送队列成功');
// exit;
// $this->success('视频生成中', 13);
// 校验商品分类是否在允许试戴分类中
$goodsService = new GoodsService();
$is_allowed = $goodsService->isCategoryAllowed('', $params['goods_id']);
......@@ -177,12 +187,6 @@ class AiTryon extends Common
$this->error('商品所属分类不允许试戴');
}
//开发过程中临时调试代码
// \think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => 'cgt-20260518151431-zcrgp', 'user' => $user, 'id'=> 214], 'shopro-high');
// $this->success('推送队列成功');
// exit;
// $this->success('视频生成中', 13);
// 校验试戴次数 && 扣除积分
$userService = new User();
$res = $userService->isTry($user->id);
......@@ -208,6 +212,7 @@ class AiTryon extends Common
'ai_type' => 1,
'ai_status' => 0,
'ai_task_id' => '',
'createtime' => time()
];
$id = $tryonModel->insertGetId($tryonData);
......
......@@ -5,6 +5,7 @@ namespace addons\shopro\job;
use addons\shopro\service\user\Ai;
use app\admin\model\shopro\AiTryon as AiTryOnModel;
use think\queue\Job;
use addons\shopro\job\BaseJob;
/**
* AI生成图片
......@@ -27,6 +28,16 @@ class AiImgGen extends BaseJob
$user = $data['user'];
$user_id = isset($user['id']) ? $user['id'] : 0;
try{
$aiService = new Ai();
$aiService->sendNotification($user_id, $id);
$this->debug_log('消息发送成功666');
$job->delete();
} catch (\Exception $e) {
format_log_error_custom_name($e, '[AI图片发现消息异常]', '', 'gen_ai');
}
exit;
$this->debug_log('***************************** '.date('Y-m-d H:i:s'). '[AI图片异步队列]AI图片生成脚本开始 userid '.$user_id.' id:'.$id.' ***********************************'.PHP_EOL);
// 校验入参
......
......@@ -48,7 +48,7 @@ class AiVideoSuccess extends Notification
'WechatMiniProgram' => [
'category_id' => 670,
'tid' => '', // 需要在后台配置模板ID
'kid' => [1,2,3],
'kid' => [2,6,7],
'scene_desc' => '3D试戴成功通知用户',
'fields' => [
[
......
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