From ea0fdf67eecee16d93fb33639cda5d43995734c2 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Tue, 9 Jan 2024 11:42:43 +0800 Subject: [PATCH] chore: refactor for re-design (#17) --- dao/item.go | 3 ++- monitor/bsc_block_processor.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dao/item.go b/dao/item.go index e6ae82b..51139be 100644 --- a/dao/item.go +++ b/dao/item.go @@ -192,7 +192,8 @@ func (dao *dbItemDao) Search(context context.Context, categoryId int64, address, } if len(keyword) > 0 { - rawSql = rawSql + ` and name like ?` + rawSql = rawSql + ` and (name like ? or description like ?) ` + parameters = append(parameters, "%"+keyword+"%") parameters = append(parameters, "%"+keyword+"%") } diff --git a/monitor/bsc_block_processor.go b/monitor/bsc_block_processor.go index 88d8bf5..c123b43 100644 --- a/monitor/bsc_block_processor.go +++ b/monitor/bsc_block_processor.go @@ -204,8 +204,9 @@ func (p *BscBlockProcessor) handleEventList(blockHeight uint64, l types.Log) (st return "", err } - rawSql := fmt.Sprintf("update items set status = %d, price = %s, updated_bsc_height = %d where group_id = %d ", - database.ItemListed, event.Price, blockHeight, event.GroupId) + // only list Objects, i.e., pictures + rawSql := fmt.Sprintf("update items set status = %d, price = %s, updated_bsc_height = %d where group_id = %d and `type` = %d", + database.ItemListed, event.Price, blockHeight, event.GroupId, database.OBJECT) return rawSql, nil }