Skip to content

Commit

Permalink
fix: 合集 Badge Token ID
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjies committed Aug 2, 2024
1 parent e05a0f7 commit cb68587
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/app/dao/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,17 @@ func (d *Dao) GetCollectionQuest(r request.GetCollectionQuestRequest) (questList
collectionID, idErr := cast.ToUintE(r.ID)
if idErr == nil {
// 查询合辑信息
err = d.db.Model(&model.Collection{}).Select("collection.*,COALESCE(tr.title,collection.title) as title,COALESCE(tr.description,collection.description) as description").
err = d.db.Model(&model.Collection{}).Select("collection.*,COALESCE(tr.title,collection.title) as title,COALESCE(tr.description,collection.description) as description,b.badge_token_id,b.chain_id as badge_chain_id").
Joins("left join user_challenges b ON collection.token_id=b.token_id AND b.address= ?", r.Address).
Joins("LEFT JOIN collection_translated as tr ON collection.id = tr.collection_id AND tr.language = ?", r.Language).
Where("collection.id", collectionID).First(&collection).Error
if err != nil {
return questList, collection, err
}
} else {
// 查询合辑信息
err = d.db.Model(&model.Collection{}).Select("collection.*,COALESCE(tr.title,collection.title) as title,COALESCE(tr.description,collection.description) as description").
err = d.db.Model(&model.Collection{}).Select("collection.*,COALESCE(tr.title,collection.title) as title,COALESCE(tr.description,collection.description) as description,b.badge_token_id,b.chain_id as badge_chain_id").
Joins("left join user_challenges b ON collection.token_id=b.token_id AND b.address= ?", r.Address).
Joins("LEFT JOIN collection_translated as tr ON collection.id = tr.collection_id AND tr.language = ?", r.Language).
Where("collection.uuid", r.ID).First(&collection).Error
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion internal/app/model/response/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ type GetCollectionChallengeUserPageDataResult struct {

type GetCollectionRes struct {
model.Collection
Claimed bool `gorm:"-" json:"claimed"`
Claimed bool `gorm:"-" json:"claimed"`
BadgeTokenID string `gorm:"column:badge_token_id" json:"badge_token_id"`
BadgeChainID int64 `gorm:"column:badge_chain_id" json:"badge_chain_id"`
}

type CheckQuestInCollectionRes struct {
Expand Down

0 comments on commit cb68587

Please sign in to comment.