Commit 916986bf authored by 刘小敏's avatar 刘小敏

AI生成视频接口优化

parent 0fac941e
...@@ -193,6 +193,8 @@ class AiTryon extends Common ...@@ -193,6 +193,8 @@ class AiTryon extends Common
*/ */
public function genVideo() public function genVideo()
{ {
if (!$this->request->isPost()) { if (!$this->request->isPost()) {
$this->error('请用post方式请求'); $this->error('请用post方式请求');
} }
...@@ -238,7 +240,7 @@ class AiTryon extends Common ...@@ -238,7 +240,7 @@ class AiTryon extends Common
$tryonData['ai_status'] = 2; $tryonData['ai_status'] = 2;
$tryonData['ai_err_msg'] = $res['msg']; $tryonData['ai_err_msg'] = $res['msg'];
$tryonModel->save($tryonData); $tryonModel->insertGetId($tryonData);
$this->error($res['msg']); $this->error($res['msg']);
...@@ -247,12 +249,11 @@ class AiTryon extends Common ...@@ -247,12 +249,11 @@ class AiTryon extends Common
// 保存一条 我的试戴 // 保存一条 我的试戴
$tryonData['ai_status'] = 0; $tryonData['ai_status'] = 0;
$tryonData['ai_task_id'] = isset($res['data']) ? $res['data'] : ''; $tryonData['ai_task_id'] = isset($res['data']) ? $res['data'] : '';
$tryonModel->save($tryonData); $id = $tryonModel->insertGetId($tryonData);
$id = $tryonModel->id;
//试戴次数+1 //试戴次数+1
$userService = new User(); $userService = new User();
$res = $userService->addTryTimes($user->id); $userService->addTryTimes($user->id);
// 推送队列 // 推送队列
\think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => $res['data'], 'user' => $user], 'shopro-high'); \think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => $res['data'], 'user' => $user], 'shopro-high');
......
...@@ -929,5 +929,6 @@ if (!function_exists('debug_echo')) { ...@@ -929,5 +929,6 @@ if (!function_exists('debug_echo')) {
function debug_echo($text='') function debug_echo($text='')
{ {
echo PHP_EOL . '------' . $text . '------' . PHP_EOL ; echo PHP_EOL . '------' . $text . '------' . PHP_EOL ;
\think\Log::info($text);
} }
} }
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