go-common/app/interface/main/app-view/dao/ai/dao.go

35 lines
622 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package ai
import (
"context"
"go-common/app/interface/main/app-view/conf"
bm "go-common/library/net/http/blademaster"
"go-common/library/net/metadata"
)
const (
_av2GameURL = "/avid2gameid"
)
type Dao struct {
client *bm.Client
av2GameURL string
}
func New(c *conf.Config) (d *Dao) {
d = &Dao{
client: bm.NewClient(c.HTTPGameAsync),
av2GameURL: c.Host.AI + _av2GameURL,
}
return
}
func (d *Dao) Av2Game(c context.Context) (res map[int64]int64, err error) {
ip := metadata.String(c, metadata.RemoteIP)
if err = d.client.Get(c, d.av2GameURL, ip, nil, &res); err != nil {
return
}
return
}