diff --git a/src/dao/advertising_space_dao.go b/src/dao/advertising_space_dao.go index 2683cdd..ebf7d69 100644 --- a/src/dao/advertising_space_dao.go +++ b/src/dao/advertising_space_dao.go @@ -4,4 +4,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" type AdvertisingSpaceDao interface { AdvertisingSpaceAll() (*[]model.AdvertisingSpace, error) + GetAdvertisingSpace(id string) (m *model.AdvertisingSpace, err error) } diff --git a/src/implement/advertising_space_implement.go b/src/implement/advertising_space_implement.go index a6dfe32..b7a07c3 100644 --- a/src/implement/advertising_space_implement.go +++ b/src/implement/advertising_space_implement.go @@ -22,3 +22,14 @@ func (a AdvertisingSpaceDb) AdvertisingSpaceAll() (*[]model.AdvertisingSpace, er } return &m, nil } +func (a AdvertisingSpaceDb) GetAdvertisingSpace(id string) (m *model.AdvertisingSpace, err error) { + m = new(model.AdvertisingSpace) + has, err := a.Db.Where("id=?", id).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +}