123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- //Items GET 获取全部内容
- async function getPet(){
- let response = await fetch("https://web2023.fmode.cn/parse/classes/Items?", {
- "headers": {
- "accept": "*/*",
- "accept-language": "zh-CN,zh;q=0.9",
- "if-none-match": "W/\"7e0-mc6U9HFyuJHJIduZnf+lM36E+qs\"",
- "x-parse-application-id": "dev"
- },
- "referrer": "http://127.0.0.1:4040/",
- "referrerPolicy": "strict-origin-when-cross-origin",
- "body": null,
- "method": "GET",
- "mode": "cors",
- "credentials": "omit"
- });
- // console.log(response)
- // return []
- if(response?.status=="200"){
- let json = await response.json()
- // console.log(json)
- return json?.results || []
- }else{
- return []
- }
- }
- async function main(){
- // let petList = await getPet()
- // console.log(petList)
- // let list = await ClassesGet("Pet")
- // console.log(list)
- let list = await ClassesGet("Items")
- console.log(list)
- }
- main()
- // 通过函数封装,实现多个表的查询
- async function ClassesGet(className){
- let response = await fetch("https://web2023.fmode.cn/parse/classes/"+className, {
- "headers": {
- "accept": "*/*",
- "accept-language": "zh-CN,zh;q=0.9",
- "if-none-match": "W/\"7e0-mc6U9HFyuJHJIduZnf+lM36E+qs\"",
- "x-parse-application-id": "dev"
- },
- "referrer": "http://127.0.0.1:4040/",
- "referrerPolicy": "strict-origin-when-cross-origin",
- "body": null,
- "method": "GET",
- "mode": "cors",
- "credentials": "omit"
- });
- // console.log(response)
- // return []
- if(response?.status=="200"){
- let json = await response.json()
- // console.log(json)
- return json?.results || []
- }else{
- return []
- }
- }
- // //Items Post 创建数据
- // fetch("https://web2023.fmode.cn/parse/classes/Items", {
- // "headers": {
- // "accept": "*/*",
- // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- // "content-type": "text/plain;charset=UTF-8",
- // "x-parse-application-id": "dev"
- // },
- // "referrer": "http://127.0.0.1:4040/",
- // "referrerPolicy": "strict-origin-when-cross-origin",
- // "body": "{\"category\": \"二手交易\",\"title\": \"ipad9二手出售\",\"publisher\": \"耶耶\", \n \"headImage\":\"/assets/images/black.png\",\"name\":\"ipad9\",\"amount\":800\n }",
- // "method": "POST",
- // "mode": "cors",
- // "credentials": "omit"
- // });
- // //Items Put 添加数据
- // fetch("https://web2023.fmode.cn/parse/classes/Items/l3XZKsAIPO", {
- // "headers": {
- // "accept": "*/*",
- // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- // "content-type": "text/plain;charset=UTF-8",
- // "x-parse-application-id": "dev"
- // },
- // "referrer": "http://127.0.0.1:4040/",
- // "referrerPolicy": "strict-origin-when-cross-origin",
- // "body": "{\"location\":\"大学生活动中心\",\"image\":\"/assets/images/ipad9.jpg\",\"content\":\"不可议价\",\"repliesId\":\"6\"}",
- // "method": "PUT",
- // "mode": "cors",
- // "credentials": "omit"
- // });
- // //Items Detele 删除数据
- // fetch("https://web2023.fmode.cn/parse/classes/Items/l3XZKsAIPO", {
- // "headers": {
- // "accept": "*/*",
- // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- // "x-parse-application-id": "dev"
- // },
- // "referrer": "http://127.0.0.1:4040/",
- // "referrerPolicy": "strict-origin-when-cross-origin",
- // "body": null,
- // "method": "DELETE",
- // "mode": "cors",
- // "credentials": "omit"
- // });
|