@@ -0,0 +1,62 @@
|
||||
package officialser
|
||||
|
||||
import (
|
||||
"91porn-server/app/service/adser"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/v/officialmod"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// QueryAll 查询列表
|
||||
func QueryAll(in *officialmod.QueryCond, ver, sysType string) ([]*officialmod.OfficialConfigApp, stderr.Code) {
|
||||
//应用推荐模块的广告,改到由数据中心拿数据
|
||||
if in.Type == "1" {
|
||||
// 这里不能直接拷贝,可能其它产品的位置ID不一样
|
||||
jtAds, err := adser.JtAdvertiseThreeServer()
|
||||
if err != nil {
|
||||
log.Error("JtAdvertiseThreeServer error occur", log.E(err))
|
||||
return nil, stderr.Failure
|
||||
}
|
||||
|
||||
list := make([]*officialmod.OfficialConfigApp, 0)
|
||||
for _, loc := range jtAds {
|
||||
pos, err := strconv.Atoi(loc.AdvertiseLocationCode)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if pos != 200 && pos != 201 {
|
||||
continue
|
||||
}
|
||||
for _, ad := range loc.AdDetailInfoList {
|
||||
if pos == 200 {
|
||||
list = append(list, &officialmod.OfficialConfigApp{
|
||||
OfficialName: ad.AdvertiseName,
|
||||
OfficialDesc: ad.AdvertiseName,
|
||||
OfficialImg: ad.GetCoverLsj(),
|
||||
OfficialUrl: strings.ReplaceAll(ad.AdvertiseUrl, "inner://yinseinner/", "yinseinner://"),
|
||||
Position: 1,
|
||||
OfficialType: "1",
|
||||
})
|
||||
}
|
||||
if pos == 201 {
|
||||
list = append(list, &officialmod.OfficialConfigApp{
|
||||
OfficialName: ad.AdvertiseName,
|
||||
OfficialDesc: ad.AdvertiseName,
|
||||
OfficialImg: ad.GetCoverLsj(),
|
||||
OfficialUrl: strings.ReplaceAll(ad.AdvertiseUrl, "inner://yinseinner/", "yinseinner://"),
|
||||
Position: 2,
|
||||
OfficialType: "1",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return list, stderr.Success
|
||||
}
|
||||
list, err := officialmod.Query(in.Type)
|
||||
if err != nil {
|
||||
return nil, stderr.ErrDbQueryError
|
||||
}
|
||||
return list, stderr.Success
|
||||
}
|
||||
Reference in New Issue
Block a user