feat: 使用静态arp处理通信

This commit is contained in:
2025-07-18 13:16:07 +08:00
parent e9ad1f0256
commit 9af2d3e87e
6 changed files with 372 additions and 75 deletions

View File

@@ -1278,6 +1278,124 @@ export class DataClient {
}
return Promise.resolve<Board[]>(null as any);
}
/**
* 更新板卡名称(管理员权限)
* @param boardId (optional)
* @param newName (optional)
*/
updateBoardName(boardId: string | undefined, newName: string | undefined): Promise<number> {
let url_ = this.baseUrl + "/api/Data/UpdateBoardName?";
if (boardId === null)
throw new Error("The parameter 'boardId' cannot be null.");
else if (boardId !== undefined)
url_ += "boardId=" + encodeURIComponent("" + boardId) + "&";
if (newName === null)
throw new Error("The parameter 'newName' cannot be null.");
else if (newName !== undefined)
url_ += "newName=" + encodeURIComponent("" + newName) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "POST",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processUpdateBoardName(_response);
});
}
protected processUpdateBoardName(response: Response): Promise<number> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
} else if (status === 400) {
return response.text().then((_responseText) => {
let result400: any = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = ProblemDetails.fromJS(resultData400);
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
});
} else if (status === 500) {
return response.text().then((_responseText) => {
return throwException("A server side error occurred.", status, _responseText, _headers);
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<number>(null as any);
}
/**
* 更新板卡状态(管理员权限)
* @param boardId (optional)
* @param newStatus (optional)
*/
updateBoardStatus(boardId: string | undefined, newStatus: BoardStatus | undefined): Promise<number> {
let url_ = this.baseUrl + "/api/Data/UpdateBoardStatus?";
if (boardId === null)
throw new Error("The parameter 'boardId' cannot be null.");
else if (boardId !== undefined)
url_ += "boardId=" + encodeURIComponent("" + boardId) + "&";
if (newStatus === null)
throw new Error("The parameter 'newStatus' cannot be null.");
else if (newStatus !== undefined)
url_ += "newStatus=" + encodeURIComponent("" + newStatus) + "&";
url_ = url_.replace(/[?&]$/, "");
let options_: RequestInit = {
method: "POST",
headers: {
"Accept": "application/json"
}
};
return this.http.fetch(url_, options_).then((_response: Response) => {
return this.processUpdateBoardStatus(_response);
});
}
protected processUpdateBoardStatus(response: Response): Promise<number> {
const status = response.status;
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
if (status === 200) {
return response.text().then((_responseText) => {
let result200: any = null;
let resultData200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return result200;
});
} else if (status === 400) {
return response.text().then((_responseText) => {
let result400: any = null;
let resultData400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
result400 = ProblemDetails.fromJS(resultData400);
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
});
} else if (status === 500) {
return response.text().then((_responseText) => {
return throwException("A server side error occurred.", status, _responseText, _headers);
});
} else if (status !== 200 && status !== 204) {
return response.text().then((_responseText) => {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
});
}
return Promise.resolve<number>(null as any);
}
}
export class DDSClient {