Commit 4291cb0c by haojie

1

parent 9b2c7c26
......@@ -19,7 +19,7 @@ public function submit($user_id, array $data = [])
# task表新增一条记录
$type = $data['type'] ?? '';
$prompt = $data['prompt'] ?? '';
$prompt_img = $data['prompt_img'];
$prompt_img = $data['prompt_img'] ?? [];
$prompt_num = $data['prompt_num'] ?? '';
if (empty($type) || empty($prompt)) {
throw new UserException('任务类型不能为空');
......@@ -32,7 +32,7 @@ public function submit($user_id, array $data = [])
# 判断类型
if ($type == self::TYPE_IMG_TO_IMG) {
# 图片转图片
if (empty($prompt_img)) {
if (!count($prompt_img)) {
throw new UserException('图片不能为空');
}
} elseif ($type == self::TYPE_TEXT_TO_IMG) {
......@@ -82,7 +82,7 @@ public function gpt_callback($data = [])
$user_id = $credentials['user_id'];
$task_id = $credentials['task_id'];
# 可选字段
$prompt_img = $credentials['prompt_img'] ?? null;
$prompt_img = $credentials['prompt_img'] ?? '';
$result_img = $credentials['result_img'] ?? '';
# 判断必须字段
if (empty($type) || empty($prompt) || empty($user_id) || empty($task_id)) {
......
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