From df7b905c09a2d98b5f59e4a303eca84c8827ffa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Wed, 6 Dec 2023 14:11:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6946dbf..3d4325c 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ const database = { { id: 4, user_name:'xx4', avatar:'xx4.png', create_time:'2022-01-02 12:12:12' } ], images: [ - { id: 1, title:'xx1', content:'xx1.png', user_id: 1, article_id: 2 } - { id: 2, title:'xx2', content:'xx2.png', user_id: 1, article_id: 2 } - { id: 3, title:'xx3', content:'xx3.png', user_id: 2, article_id: 4 } - { id: 4, title:'xx4', content:'xx4.png', user_id: 2, article_id: 4 } + { id: 1, content:'xx1.png', user_id: 1, article_id: 2, text:['xx1'] } + { id: 2, content:'xx2.png', user_id: 1, article_id: 2, text:['xx2'] } + { id: 3, content:'xx3.png', user_id: 2, article_id: 4, text:['xx3'] } + { id: 4, content:'xx4.png', user_id: 2, article_id: 4, text:['xx4'] } ] } ``` @@ -34,15 +34,15 @@ const database = { ```javascript // GET 查询id为1的用户列表, 要求列表中每项只返回 id, 用户名, 头像, 以及符合筛选条件的总数 total -const query = `users(id:1){total,list{id,user_name,avatar}}` -fetch('/api?'+query).then(res => res.json()).then(data => { +const query = `/api?query={users(id:1){total,list{id,user_name,avatar}}}` +fetch(query).then(res => res.json()).then(data => { console.log(data) // { data: { users: { total:1, list:[{ id: 1, user_name:'xx1', avatar:'xx1.png' }] } } } }) // GET 查询 user_id 为 2 的图像列表, 并且包含 user 的部分信息, 以及符合筛选条件的总数 total -const query = `images(user_id:2){total,list{id,content,user:{id,username,avatar}}}` -fetch('/api?'+query).then(res => res.json()).then(data => { +const query = `/api?query={images(user_id:2){total,list{id,content,user{id,user_name,avatar}}}}` +fetch(query).then(res => res.json()).then(data => { console.log(data) /* { @@ -60,8 +60,8 @@ fetch('/api?'+query).then(res => res.json()).then(data => { }) // GET 查询所有图像的前2个(第一页) -const query = `images(first:2){total,list{id,content,user:{id,username,avatar}}}` -fetch('/api?'+query).then(res => res.json()).then(data => { +const query = `/api?query={images(first:2){total,list{id,content,user:{id,user_name,avatar}}}}` +fetch(query).then(res => res.json()).then(data => { console.log(data) /* { @@ -80,8 +80,8 @@ fetch('/api?'+query).then(res => res.json()).then(data => { // GET 查询所有图像的指定id之后的前2个(翻页) -const query = `images(after:2,first:2){total,list{id,content,user:{id,username,avatar}}}` -fetch('/api?'+query).then(res => res.json()).then(data => { +const query = `/api?query={images(after:2,first:2){total,list{id,content,user{id,user_name,avatar}}}}` +fetch(query).then(res => res.json()).then(data => { console.log(data) /* { @@ -156,7 +156,8 @@ type Article struct { * 以上为当前基本数据结构和查询方法 * 如需添加筛选条件排序条件或其他字段后续补充 - +* 由于仅为OCR文本搜索提供, 目前图像对象仅支持包含文本搜索的请求 +`http://www.gameui.net/api?query={images(text:"魔力",after:32128,first:5){list{id,width,height}}}` ### 流媒体 通过流媒体服务降低视频文件加载消耗及防止恶意刷流量