bug修改
This commit is contained in:
@@ -51,7 +51,7 @@ export class BasicConstant {
|
||||
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
|
||||
,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省',
|
||||
'广西壮族自治区','海南省','重庆市','四川省','贵州省','云南省','西藏自治区',
|
||||
'陕西省','甘肃省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
|
||||
'陕西省','甘肃省','青海省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
|
||||
|
||||
//通知事件ID
|
||||
static readonly notification_back_refreshData = 250529;//返回上页通知刷新数据
|
||||
|
||||
@@ -7,6 +7,7 @@ import fs from '@ohos.file.fs';
|
||||
import { fileIo } from '@kit.CoreFileKit';
|
||||
import util from '@ohos.util';
|
||||
import { i18n } from '@kit.LocalizationKit';
|
||||
import { connection } from '@kit.NetworkKit';
|
||||
export class ChangeUtil {
|
||||
/**
|
||||
* 将HashMap转成JsonString
|
||||
@@ -167,5 +168,8 @@ export class ChangeUtil {
|
||||
if (str.length === 0) return false;
|
||||
return i18n.Unicode.isDigit(str.charAt(0));
|
||||
}
|
||||
|
||||
//判断是否有网络
|
||||
static isOnline(): boolean {
|
||||
return connection.hasDefaultNetSync();
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { HashMap } from '@kit.ArkTS';
|
||||
import { CryptoJS } from '@ohos/crypto-js'
|
||||
import { Base64Util } from './Base64Util';
|
||||
import { ChangeUtil } from './ChangeUtil'
|
||||
|
||||
import { bundleManager} from '@kit.AbilityKit';
|
||||
interface HdRequestOptions {
|
||||
baseURL?: string
|
||||
}
|
||||
@@ -24,6 +24,7 @@ export interface TimestampBean {
|
||||
|
||||
|
||||
}
|
||||
|
||||
class HdHttp {
|
||||
baseURL: string
|
||||
|
||||
@@ -146,14 +147,14 @@ class HdHttp {
|
||||
}
|
||||
});
|
||||
// 处理响应结果。
|
||||
return promise.then((data) => {
|
||||
return promise.then(async (data) => {
|
||||
if (data.responseCode === http.ResponseCode.OK) {
|
||||
logger.info('Response httpReq:' + data.result);
|
||||
let json:TimestampBean = JSON.parse(data.result.toString()) as TimestampBean;
|
||||
let tp = json.timestamp;
|
||||
datas.set("user_uuid", authStore.getUser().uuid?authStore.getUser().uuid:'');
|
||||
datas.set("client_type", 'A');
|
||||
datas.set("version",'4.0.0' );
|
||||
datas.set("client_type", 'H');
|
||||
datas.set("version", await this.getVersion() );
|
||||
datas.set('timestamp',tp+'');
|
||||
return this.posts<T>(url, datas);
|
||||
} else {
|
||||
@@ -221,6 +222,15 @@ class HdHttp {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getVersion() {
|
||||
let res=await bundleManager.getBundleInfoForSelf(
|
||||
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
|
||||
bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA
|
||||
)
|
||||
return res.versionName
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const hdHttp = new HdHttp({ baseURL: '' })
|
||||
|
||||
Reference in New Issue
Block a user