This commit is contained in:
aozhiwei 2024-11-29 15:52:11 +08:00
parent 3492126047
commit d2a7e9d8d5

View File

@ -1,8 +1,10 @@
package service
import (
"q5"
"f5"
"main/model"
"main/vo"
"main/constant"
)
@ -16,9 +18,15 @@ func (this *friend) init() {
func (this *friend) unInit() {
}
func (this *friend) List(accountId string) (error, []*model.User) {
friends := []*model.Friend{}
result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(new(model.Friend).TableName()).Where(
"account_id = ? AND item_num > ?", accountId, 0).Find(&friends)
return result.Error, friends
func (this *friend) List(accountId string) (error, []*vo.Friend) {
friends := []*model.User{}
result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(new(model.User).TableName()).Where(
"invited = ?", accountId).Find(&friends)
friendsVo := []*vo.Friend{}
for _, u := range(friends) {
friendVo := new(vo.Friend)
friendVo.FromModel(u)
q5.AppendSlice(&friendsVo, friendVo)
}
return result.Error, friendsVo
}