Exemplo n.º 1
0
// 保存广告图片
func (this *advertisementService) SaveImage(partnerId int, advertisementId int, v *ad.ValueImage) (int, error) {
	pa := this._rep.GetPartnerAdvertisement(partnerId)
	var adv ad.IAdvertisement = pa.GetById(advertisementId)
	if adv != nil {
		if adv.Type() == ad.TypeGallery {
			gad := adv.(ad.IGalleryAd)
			return gad.SaveImage(v)
		}
	}
	return -1, nil
}
Exemplo n.º 2
0
// 删除广告图片
func (this *advertisementService) DelAdImage(partnerId, advertisementId, imgId int) error {
	pa := this._rep.GetPartnerAdvertisement(partnerId)
	var adv ad.IAdvertisement = pa.GetById(advertisementId)
	if adv != nil {
		if adv.Type() == ad.TypeGallery {
			gad := adv.(ad.IGalleryAd)
			return gad.DelImage(imgId)
		}
	}
	return nil
}
Exemplo n.º 3
0
// 保存广告
func (this *advertisementService) SaveAdvertisement(partnerId int, v *ad.ValueAdvertisement) (int, error) {
	pa := this._rep.GetPartnerAdvertisement(partnerId)
	var adv ad.IAdvertisement
	if v.Id > 0 {
		adv = pa.GetById(v.Id)
		adv.SetValue(v)
	} else {
		adv = pa.CreateAdvertisement(v)
	}
	return adv.Save()
}