You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
599 B
25 lines
599 B
9 months ago
|
package service
|
||
|
|
||
|
import (
|
||
|
"pure/global"
|
||
|
"pure/model"
|
||
|
"pure/model/request"
|
||
|
)
|
||
|
|
||
|
func GetNotifyList(userId string, info *request.SearchNotify) ([]model.Notify, int64, error) {
|
||
|
var (
|
||
|
err error
|
||
|
total int64
|
||
|
result []model.Notify
|
||
|
)
|
||
|
limit := info.PageSize
|
||
|
offset := info.PageSize * (info.Page - 1)
|
||
|
db := global.MG_DB.Model(&model.Notify{}).Where("user_id = ?", userId)
|
||
|
if info.RelationType != "" {
|
||
|
db = db.Where("relation_type = ?", info.RelationType)
|
||
|
}
|
||
|
_ = db.Count(&total).Error
|
||
|
err = db.Order("id DESC").Offset(offset).Limit(limit).Find(&result).Error
|
||
|
return result, total, err
|
||
|
}
|