ad_download_url.go 559 Bytes
package models

import (
	"database/sql"

	db "client/icesimba.ad/database"
)

func GetAdDownloadUrl(adId string, platform string, channel string) (url string, err error) {
	platObj, err := QueryPlatformByName(platform)
	chanObj, err := QueryChannelByName(channel)
	if err != nil {
		return
	}
	sqlQu := "SELECT url_content FROM ice_ad_downloadurl WHERE ad_id=? AND platform_id=? AND channel_id=?"
	var urlNull sql.NullString
	db.SqlDB.QueryRow(sqlQu, adId, platObj.Id, chanObj.Id).Scan(
		&urlNull,
	)
	if urlNull.Valid {
		url = urlNull.String
	}
	return
}