主题
按激活码解绑 - UnBindEx
函数简介
解绑指定激活码的单独授权。同机上的普通授权和其他激活码授权保持不变。
若当前进程是用 LoginEx 登录的,调用 UnBind 也会改走本接口,并使用这次登录的激活码。解绑成功后,定时心跳不再继续请求 LoginEx。
换机、且新设备还没有这条授权时,仍使用 强制解绑 - ForceUnBind。
返回数据格式:
json
{
"Code": 1,
"ServerTime": "2026-04-24 10:00:00.000",
"Message": "",
"LicenseKey": "XXXX-XXXX"
}| 字段名 | 说明 |
|---|---|
| Code | 1 成功,0 失败。 |
| ServerTime | 服务器时间。 |
| Message | 提示信息;失败时多为 错误码:中文描述。完整对照见 客户端错误码说明。 |
| LicenseKey | 本次解绑的激活码。 |
常见错误码(Message 字段)
| Message | 含义 |
|---|---|
2003:参数无效 | 未传激活码 |
2004:用户不存在 | 用户不存在 |
2015:未找到可解绑设备授权 | 当前机器上没有这张激活码的单独授权 |
2016:试用授权不支持解绑 | 试用授权禁止解绑 |
接口名称
UnBindExDLL调用
long UnBindEx(string userCode, string softCode, string softVersion, string dealerCode, string licenseKey);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| userCode | 字符串 | 用户码。 |
| softCode | 字符串 | 软件码。 |
| softVersion | 字符串 | 软件版本。 |
| dealerCode | 字符串 | 经销商码。 |
| licenseKey | 字符串 | 要解绑的激活码。必填。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
OlaAuthUnbindReturn result = ola.UnBindEx("userCode", "softCode", "1.0.0", "dealerCode", "XXXX-XXXX");
// result.Code == 1 表示这一张激活码已解绑csharp
using OLAPlug;
var ola = new OLAPlugServer();
OlaAuthUnbindReturn result = ola.UnBindEx("userCode", "softCode", "1.0.0", "dealerCode", "XXXX-XXXX");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
json_result = ola.UnBindEx("userCode", "softCode", "1.0.0", "dealerCode", "XXXX-XXXX")原生 DLL 调用
cpp
long resultPtr = UnBindEx("userCode", "softCode", "1.0.0", "dealerCode", "XXXX-XXXX");
if (resultPtr != 0) {
char result[512] = {0};
GetStringFromPtr(resultPtr, result, sizeof(result));
FreeStringPtr(resultPtr);
}返回值
| 调用方式 | 返回值 | 说明 |
|---|---|---|
| SDK | OlaAuthUnbindReturn | Code == 1 表示解绑成功 |
| 原生 DLL | 非 0 | 成功,返回 JSON 字符串 |
| 原生 DLL | 0 | 失败 |
注意事项
| 项目 | 说明 |
|---|---|
| 作用范围 | 只结束这一张激活码。普通设备授权和其他激活码授权不受影响。 |
| 定时任务 | 若解绑的就是当前 LoginEx 会话的激活码,之后的心跳改走 Login。 |
| 释放内存 | 返回的字符串指针需要调用 FreeStringPtr。 |
