添加设备操作日志方法
This commit is contained in:
@@ -195,6 +195,28 @@ func (d *Device) GetVoiceAssistant(deviceId uint32) (*VoiceAssistant, error) {
|
||||
return result.Data, nil
|
||||
}
|
||||
|
||||
// 记录设备操作日志
|
||||
func (d *Device) RecordOperationLog(deviceId uint32, platform DeviceOperationLogPlatform, attribute string, value any, valueType uint8, result DeviceOperationLogResult, reason *string, userId *uint32) error {
|
||||
body := map[string]any{
|
||||
"device_id": deviceId,
|
||||
"platform": platform,
|
||||
"attribute": attribute,
|
||||
"value": value,
|
||||
"value_type": valueType,
|
||||
"result": result,
|
||||
"reason": reason,
|
||||
"user_id": userId,
|
||||
}
|
||||
res := &Result[any]{}
|
||||
if err := GetRequest().Send("device.record_operation_log", body, res); err != nil {
|
||||
return err
|
||||
}
|
||||
if res.Code != 0 {
|
||||
return fmt.Errorf("%s", res.Message)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var device *Device
|
||||
|
||||
// 获取设备相关RPC类
|
||||
|
||||
Reference in New Issue
Block a user