liuhairui 2 dni temu
rodzic
commit
642ad090ea
1 zmienionych plików z 40 dodań i 0 usunięć
  1. 40 0
      application/api/controller/WorkOrder.php

+ 40 - 0
application/api/controller/WorkOrder.php

@@ -757,6 +757,46 @@ class WorkOrder extends Api{
         return json($res);
     }
 
+    //获取图片列表
+    public function Gettexttoimagelist(){
+        if (!$this->request->isGet()) {
+            $this->error('请求方式错误');
+        }
+        $params = $this->request->param();
+        $search = input('search', '');
+        $page = isset($params['page']) ? (int)$params['page'] : 1;
+        $limit = isset($params['limit']) ? (int)$params['limit'] : 50;
+        $where = [];
+        if (!empty($search)) {
+            $where['prompt'] = ['like', '%' . $search . '%'];
+        }
+        $list = Db::name('ai_text_image')->where('mod_rq', null)
+            ->where($where)
+            ->order('id desc')
+            ->limit(($page - 1) * $limit, $limit)
+            ->select();
+        foreach ($list as &$row) {
+            if (!empty($row['old_img'])) {
+                $row['old_img'] = $this->toPublicMediaUrl((string)$row['old_img']);
+            }
+            if (!empty($row['ref_img'])) {
+                $row['ref_img'] = $this->toPublicMediaUrl((string)$row['ref_img']);
+            }
+            if (!empty($row['new_img'])) {
+                $row['new_img'] = $this->toPublicMediaUrl((string)$row['new_img']);
+            }
+        }
+        unset($row);
+        $total = Db::name('ai_text_image')->where('mod_rq', null)
+            ->where($where)
+            ->count();
+        $res['code'] = 0;
+        $res['msg'] = '成功';
+        $res['count'] = $total;
+        $res['data'] = $list;
+        return json($res);
+    }
+
     /**
      * 文生视频/图生视频接口
      */