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.
36 lines
907 B
36 lines
907 B
package newbiedao |
|
|
|
import ( |
|
"context" |
|
|
|
"go-common/app/interface/main/growup/model" |
|
"go-common/library/ecode" |
|
"go-common/library/log" |
|
"go-common/library/net/metadata" |
|
"go-common/library/xstr" |
|
"net/url" |
|
"strconv" |
|
) |
|
|
|
// GetRelations get relations |
|
func (d *Dao) GetRelations(c context.Context, mid int64, fids []int64) (res map[int64]*model.Relation, err error) { |
|
relationsRes := new(model.RelationsRes) |
|
|
|
uv := url.Values{} |
|
uv.Set("mid", strconv.FormatInt(mid, 10)) |
|
uv.Set("fids", xstr.JoinInts(fids)) |
|
|
|
err = d.httpRead.Get(c, d.c.Host.RelationsURI, metadata.String(c, metadata.RemoteIP), uv, relationsRes) |
|
if err != nil { |
|
log.Error("s.dao.GetRelations error(%v)", err) |
|
return |
|
} |
|
if relationsRes.Code != ecode.OK.Code() { |
|
err = ecode.Int(relationsRes.Code) |
|
log.Error("s.dao.GetRelations get relations failed, ecode: %d", relationsRes.Code) |
|
return |
|
} |
|
|
|
res = relationsRes.Data |
|
return |
|
}
|
|
|