2026-08-09 10:43:45 +08:00
package friend
import (
"context"
"time"
2026-08-10 11:42:45 +08:00
"bsm/full/module/social/relation/internal/impl"
"bsm/full/module/social/relation/internal/models"
pb "bsm/full/module/social/relation/pb"
2026-08-09 10:43:45 +08:00
"git.apinb.com/bsm-sdk/core/errcode"
"git.apinb.com/bsm-sdk/core/printer"
"git.apinb.com/bsm-sdk/core/service"
"git.apinb.com/bsm-sdk/core/vars"
)
// 受你欢迎的,置顶
2026-08-09 20:14:57 +08:00
func DoPopular ( ctx context . Context , in * pb . IdentRequest ) ( reply * pb . DataStatusReply , err error ) {
2026-08-09 10:43:45 +08:00
// parse authorization meta.
auth , err := service . ParseMetaCtx ( ctx , nil )
if err != nil {
return nil , err
}
if in . Identity == "" {
return nil , errcode . ErrInvalidArgument
}
2026-09-22 21:15:34 +08:00
// 归属列是 passport_id, in.Identity 是好友身份( friend_relation_identity)
err = impl . DBService . Model ( models . RelationFriend { } ) . Where ( "passport_id=? and friend_relation_identity=?" , auth . ID , in . Identity ) . UpdateColumn ( "popular" , 1 ) . Error
2026-08-09 10:43:45 +08:00
if err != nil {
printer . Error ( err . Error ( ) )
return nil , errcode . ErrDB
}
2026-08-09 20:14:57 +08:00
return & pb . DataStatusReply {
2026-08-09 10:43:45 +08:00
Data : vars . OK ,
Timeseq : time . Now ( ) . UnixMilli ( ) ,
} , nil
}