|
@@ -2,6 +2,7 @@ import { ArrayList, HashMap } from '@kit.ArkTS';
|
|
|
import http from '@ohos.net.http';
|
|
|
import { SZYXLocalStorageHelper } from '../utils/SZYXLocalStorageHelper';
|
|
|
import { SZYXLocalStorageKeys } from '../utils/SZYXLocalStorageKeys';
|
|
|
+import { ToolsHelperForTS } from '../utils/ToolsHelperForTS';
|
|
|
|
|
|
|
|
|
type HttpParamsGet = {
|
|
@@ -311,7 +312,7 @@ export class HttpHelper {
|
|
|
if (query) {
|
|
|
let q = query
|
|
|
if (typeof query === 'object') {
|
|
|
- q = this.classToRecord(query)
|
|
|
+ q = ToolsHelperForTS.classToRecord(query)
|
|
|
}
|
|
|
u = `${u}${u.indexOf('?') < 0 ? '?' : u.endsWith('$') ? '' : '&'}`
|
|
|
Object.entries(q).forEach((row) => {
|
|
@@ -331,7 +332,7 @@ export class HttpHelper {
|
|
|
let u = ''
|
|
|
let q = data
|
|
|
if (typeof data === 'object') {
|
|
|
- q = this.classToRecord(data)
|
|
|
+ q = ToolsHelperForTS.classToRecord(data)
|
|
|
}
|
|
|
Object.entries(q).forEach((row) => {
|
|
|
if (row[1]) {
|
|
@@ -342,13 +343,5 @@ export class HttpHelper {
|
|
|
return u
|
|
|
}
|
|
|
|
|
|
- private classToRecord(obj: Object): Record<string, string> {
|
|
|
- const record: Record<string, string> = {} as Record<string, string>;
|
|
|
- for (const key in obj) {
|
|
|
- if (obj.hasOwnProperty(key)) {
|
|
|
- record[key] = obj[key];
|
|
|
- }
|
|
|
- }
|
|
|
- return record;
|
|
|
- }
|
|
|
+
|
|
|
}
|