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