This commit is contained in:
Daniel 2025-07-05 10:07:36 +08:00
parent 0446aeb1c6
commit 2b753ac16f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -45,8 +45,18 @@ import (
) )
func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) { func (tx *Transaction) doSetAttrViewGroup(operation *Operation) (ret *TxErr) {
err := SetAttributeViewGroup(operation.AvID, operation.BlockID, operation.Data.(*av.ViewGroup)) data, err := gulu.JSON.MarshalJSON(operation.Data)
if err != nil { if nil != err {
logging.LogErrorf("marshal operation data failed: %s", err)
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
group := &av.ViewGroup{}
if err = gulu.JSON.UnmarshalJSON(data, &group); nil != err {
logging.LogErrorf("unmarshal operation data failed: %s", err)
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
if err = SetAttributeViewGroup(operation.AvID, operation.BlockID, group); nil != err {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()} return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
} }
return return