获取软件更新状态 - GetSoftUpdateStatus
函数简介
获取客户端软件更新状态,并返回最新版本业务信息。
返回数据格式:
{
"Code": 1,
"Message": "",
"CurrentVersion": "1.0.0",
"LatestVersion": "1.1.0",
"HasUpdate": true,
"SoftVersion": {
"SoftCode": "demo-soft",
"VersionNumber": "1.1.0",
"VersionName": "2026春季版",
"VersionType": 1,
"FileName": "demo-installer.exe",
"FileSize": 12345678,
"FileMd5": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"FileUrl": "https://example.com/demo-installer.exe",
"IsForceUpdate": false,
"UpdateContent": "修复已知问题并优化稳定性",
"ReleaseDate": "2026-04-24 09:00:00",
"IsLatest": true
}
}
| 字段名 | 类型 | 说明 |
|---|---|---|
| Code | 整数 | 结果状态码,通常 1 表示成功,0 或其他值表示失败。 |
| Message | 字符串 | 提示信息或错误信息,成功时通常为空字符串。 |
| CurrentVersion | 字符串 | 当前版本号。 |
| LatestVersion | 字符串 | 最新版本号。 |
| HasUpdate | 布尔 | 是否存在可更新版本。 |
| SoftVersion | 对象 | 版本对象信息。 |
SoftVersion 字段说明:
| 字段名 | 类型 | 说明 |
|---|---|---|
| SoftCode | 字符串 | 软件编码。 |
| VersionNumber | 字符串 | 版本号。 |
| VersionName | 字符串 | 版本名称。 |
| VersionType | 整数 | 版本类型编码。 |
| FileName | 字符串 | 安装包文件名。 |
| FileSize | 整数 | 安装包大小(字节)。 |
| FileMd5 | 字符串 | 安装包 MD5 校验值。 |
| FileUrl | 字符串 | 安装包下载地址。 |
| IsForceUpdate | 布尔 | 是否强制更新。 |
| UpdateContent | 字符串 | 更新说明内容。 |
| ReleaseDate | 字符串 | 版本发布时间。 |
| IsLatest | 布尔 | 是否为最新版本。 |
接口名称
GetSoftUpdateStatus
DLL调用
long GetSoftUpdateStatus(string userCode, string softCode, string softVersion, string dealerCode);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| userCode | 字符串 | 用户码。 |
| softCode | 字符串 | 软件码。 |
| softVersion | 字符串 | 软件版本。 |
| dealerCode | 字符串 | 经销商码。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
long result = GetSoftUpdateStatus(instance, "userCode", "softCode", "1.0.0", "dealerCode");
if (result != 0) {
char* json = GetStringFromPtr(result);
printf("更新状态: %s\n", json);
FreeStringPtr(result);
}
Python
# 待补充
返回值
成功返回 JSON 字符串格式的更新状态结果;失败返回 0。
注意事项
- 返回的字符串指针需要调用 FreeStringPtr 接口释放内存。
HasUpdate可直接用于判断是否提示更新。
