Commit 2d1841c5 authored by shajiaiming's avatar shajiaiming

优化币种搜索条件

parent b8a407aa
......@@ -82,7 +82,7 @@ func GetCoinTotal(maps interface{}) (int, error) {
if 0 == platform_id {
err = db.Model(&Coin{}).Where(term).Count(&count).Error
} else {
err = db.Model(&Coin{}).Where("FIND_IN_SET(?, platform_id)", platform_id).Where(term).Count(&count).Error
err = db.Model(&Coin{}).Where("JSON_CONTAINS(?, platform_id)", platform_id).Where(term).Count(&count).Error
}
if err != nil {
return 0, err
......@@ -123,7 +123,7 @@ func GetCoins(pageNum, pageSize int, maps interface{}) ([]*Coin, error) {
if 0 == platform_id {
err = db.Where(term).Offset(pageNum).Limit(pageSize).Find(&coins).Error
} else {
err = db.Where("FIND_IN_SET(?, platform_id)", platform_id).Where(term).Offset(pageNum).Limit(pageSize).Find(&coins).Error
err = db.Where("JSON_CONTAINS(?, platform_id)", platform_id).Where(term).Offset(pageNum).Limit(pageSize).Find(&coins).Error
}
if err != nil && err != gorm.ErrRecordNotFound {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment