diff --git a/block_parser/action_account_cell.go b/block_parser/action_account_cell.go index 9a6001b..cfb55d0 100644 --- a/block_parser/action_account_cell.go +++ b/block_parser/action_account_cell.go @@ -296,7 +296,22 @@ func (b *BlockParser) ActionBidExpiredAccountAuction(req FuncTransactionHandleRe } log.Info("ActionBidExpiredAccountAuction:", accountInfo) - if err := b.dbDao.BidExpiredAccountAuction(accountInfo, transactionInfos); err != nil { + var recordsInfos []dao.TableRecordsInfo + + recordList := builder.Records + for _, v := range recordList { + recordsInfos = append(recordsInfos, dao.TableRecordsInfo{ + AccountId: accountId, + Account: account, + Key: v.Key, + Type: v.Type, + Label: v.Label, + Value: v.Value, + Ttl: strconv.FormatUint(uint64(v.TTL), 10), + }) + } + + if err := b.dbDao.BidExpiredAccountAuction(accountInfo, recordsInfos, transactionInfos); err != nil { log.Error("ActionBidExpiredAccountAuction err:", err.Error(), toolib.JsonString(accountInfo)) resp.Err = fmt.Errorf("ActionBidExpiredAccountAuction err: %s", err.Error()) } diff --git a/block_parser/block_parser_handle.go b/block_parser/block_parser_handle.go index 441680e..7d23bca 100644 --- a/block_parser/block_parser_handle.go +++ b/block_parser/block_parser_handle.go @@ -71,7 +71,7 @@ func (b *BlockParser) registerTransactionHandle() { b.mapTransactionHandle[common.DasActionDelayApproval] = b.DasActionDelayApproval b.mapTransactionHandle[common.DasActionRevokeApproval] = b.DasActionRevokeApproval b.mapTransactionHandle[common.DasActionFulfillApproval] = b.DasActionFulfillApproval - b.mapTransactionHandle[common.DasBidExpiredAccountAuction] = b.ActionBidExpiredAccountAuction + b.mapTransactionHandle[common.DasActionBidExpiredAccountAuction] = b.ActionBidExpiredAccountAuction } diff --git a/dao/dao_account_info.go b/dao/dao_account_info.go index 5bb6a2f..1d06b83 100644 --- a/dao/dao_account_info.go +++ b/dao/dao_account_info.go @@ -246,7 +246,7 @@ func (d *DbDao) GetAccountInfoByParentAccountId(parentAccountId string) (account return } -func (d *DbDao) BidExpiredAccountAuction(accountInfo TableAccountInfo, transactionInfos []TableTransactionInfo) error { +func (d *DbDao) BidExpiredAccountAuction(accountInfo TableAccountInfo, recordsInfos []TableRecordsInfo, transactionInfos []TableTransactionInfo) error { return d.db.Transaction(func(tx *gorm.DB) error { //update account_info if err := tx.Select("expired_at", "registered_at", "block_number", "outpoint", "owner_chain_type", "owner", "owner_algorithm_id", "owner_sub_aid", "manager_chain_type", "manager", "manager_algorithm_id", "manager_sub_aid"). @@ -268,6 +268,12 @@ func (d *DbDao) BidExpiredAccountAuction(accountInfo TableAccountInfo, transacti if err := tx.Where("account_id=?", accountInfo.AccountId).Delete(&TableRecordsInfo{}).Error; err != nil { return err } + //default record + if len(recordsInfos) > 0 { + if err := tx.Create(&recordsInfos).Error; err != nil { + return err + } + } return nil }) }