| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- class Query {
- className = "";
- constructor(className) {
- this.className = className;
- }
- async getAll() {
- let response = await fetch(
- "http://1.94.237.145:1338/parsecyx/classes/" + this.className,
- {
- headers: {
- accept: "*/*",
- "accept-language":
- "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,ja;q=0.4",
- "if-none-match": 'W/"f36-Q0ech+Jn3bu0uYx1n7/k1+XDYr0"',
- "x-parse-application-id": "cyx",
- },
- referrer: "http://127.0.0.1:4040/",
- referrerPolicy: "strict-origin-when-cross-origin",
- body: null,
- method: "GET",
- mode: "cors",
- credentials: "omit",
- }
- );
- let json = [];
- if (response) {
- json = await response.json();
- }
- return json.results || [];
- }
- async getBy(id) {
- let response = await fetch(
- "http://1.94.237.145:1338/parsecyx/classes/" + this.className + "/" + id,
- {
- headers: {
- accept: "*/*",
- "accept-language":
- "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,ja;q=0.4",
- "if-none-match": 'W/"f36-Q0ech+Jn3bu0uYx1n7/k1+XDYr0"',
- "x-parse-application-id": "cyx",
- },
- referrer: "http://127.0.0.1:4040/",
- referrerPolicy: "strict-origin-when-cross-origin",
- body: null,
- method: "GET",
- mode: "cors",
- credentials: "omit",
- }
- );
- let json = {};
- if (response) {
- json = await response.json();
- }
- return json || null;
- }
- }
- class Insert {
- className = "";
- constructor(className) {
- this.className = className;
- }
- async addUser(info) {
- if (info.username) {
- method = "";
- }
- let body = JSON.stringify(info);
- let response = await fetch("http://1.94.237.145:1338/parsecyx/users", {
- headers: {
- accept: "*/*",
- "accept-language":
- "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,zh-TW;q=0.5,ja;q=0.4",
- "content-type": "text/plain",
- },
- referrer: "http://127.0.0.1:4040/",
- referrerPolicy: "strict-origin-when-cross-origin",
- // body: '{"username":"test","password":"test","email":"test@qq.com","phoneNumber":"10086","sex":"男","age":"18","_ApplicationId":"cyx","_ClientVersion":"js3.4.2","_MasterKey":"cyxmk","_InstallationId":"111053ea-8bfc-4dfc-8818-df34dd45d6b0"}',
- body: body,
- method: method,
- mode: "cors",
- credentials: "omit",
- });
- }
- }
- module.exports.Query = Query;
|