|
|
@@ -4,11 +4,8 @@ import ( |
|
|
|
"applet/app/md" |
|
|
|
"applet/app/utils" |
|
|
|
db "code.fnuoos.com/zhimeng/model.git/src" |
|
|
|
implement2 "code.fnuoos.com/zhimeng/model.git/src/implement" |
|
|
|
model2 "code.fnuoos.com/zhimeng/model.git/src/model" |
|
|
|
"code.fnuoos.com/zhimeng/model.git/src/super/implement" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"strings" |
|
|
|
) |
|
|
|
|
|
|
|
func DataCenterOriginalDataList(c *gin.Context, req md.DataCenterOriginalDataReq) md.DataCenterOriginalDataRes { |
|
|
@@ -61,37 +58,37 @@ func DataCenterOriginalDataList(c *gin.Context, req md.DataCenterOriginalDataReq |
|
|
|
// 应用 |
|
|
|
func GetAppletId(c *gin.Context, name, platform string) string { |
|
|
|
mediumId := "" |
|
|
|
sess := MasterDb(c).Where("1=1") |
|
|
|
if name != "" || platform != "" { |
|
|
|
ids := []string{"-1"} |
|
|
|
var tmp []model2.AppletApplication |
|
|
|
if name != "" { |
|
|
|
sess.And("name like ? ", "%"+name+"%") |
|
|
|
} |
|
|
|
if platform != "" { |
|
|
|
sess.And("platform = ? ", platform) |
|
|
|
} |
|
|
|
sess.Find(&tmp) |
|
|
|
for _, v := range tmp { |
|
|
|
ids = append(ids, utils.IntToStr(v.MediumId)) |
|
|
|
} |
|
|
|
mediumId = strings.Join(ids, ",") |
|
|
|
} |
|
|
|
// sess := MasterDb(c).Where("1=1") |
|
|
|
// if name != "" || platform != "" { |
|
|
|
// ids := []string{"-1"} |
|
|
|
// var tmp []model2.AppletApplication |
|
|
|
// if name != "" { |
|
|
|
// sess.And("name like ? ", "%"+name+"%") |
|
|
|
// } |
|
|
|
// if platform != "" { |
|
|
|
// sess.And("platform = ? ", platform) |
|
|
|
// } |
|
|
|
// sess.Find(&tmp) |
|
|
|
// for _, v := range tmp { |
|
|
|
// ids = append(ids, utils.IntToStr(v.MediumId)) |
|
|
|
// } |
|
|
|
// mediumId = strings.Join(ids, ",") |
|
|
|
// } |
|
|
|
return mediumId |
|
|
|
} |
|
|
|
|
|
|
|
// 广告位 |
|
|
|
func GetSlotId(c *gin.Context, state string) string { |
|
|
|
mediumId := "" |
|
|
|
if state != "" { |
|
|
|
ids := []string{"-1"} |
|
|
|
var tmp []model2.AppletApplicationAdSpaceList |
|
|
|
MasterDb(c).Where("state=?", state).Find(&tmp) |
|
|
|
for _, v := range tmp { |
|
|
|
ids = append(ids, utils.IntToStr(v.MediumId)) |
|
|
|
} |
|
|
|
mediumId = strings.Join(ids, ",") |
|
|
|
} |
|
|
|
// if state != "" { |
|
|
|
// ids := []string{"-1"} |
|
|
|
// var tmp []model2.AppletApplicationAdSpaceList |
|
|
|
// MasterDb(c).Where("state=?", state).Find(&tmp) |
|
|
|
// for _, v := range tmp { |
|
|
|
// ids = append(ids, utils.IntToStr(v.MediumId)) |
|
|
|
// } |
|
|
|
// mediumId = strings.Join(ids, ",") |
|
|
|
// } |
|
|
|
return mediumId |
|
|
|
} |
|
|
|
|
|
|
@@ -101,12 +98,12 @@ func GetAppletInfo(c *gin.Context, id string) map[string]string { |
|
|
|
"platform": "", |
|
|
|
"name": "", |
|
|
|
} |
|
|
|
NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) |
|
|
|
data, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(id) |
|
|
|
if data != nil { |
|
|
|
res["platform"] = data.Platform |
|
|
|
res["name"] = data.Name |
|
|
|
} |
|
|
|
// NewAppletApplicationDb := implement2.NewAppletApplicationDb(MasterDb(c)) |
|
|
|
// data, _ := NewAppletApplicationDb.GetAppletApplicationListByAppid(id) |
|
|
|
// if data != nil { |
|
|
|
// res["platform"] = data.Platform |
|
|
|
// res["name"] = data.Name |
|
|
|
// } |
|
|
|
return res |
|
|
|
} |
|
|
|
|
|
|
@@ -116,11 +113,11 @@ func GetSlotInfo(c *gin.Context, id string) map[string]string { |
|
|
|
"state": "", |
|
|
|
"name": "", |
|
|
|
} |
|
|
|
NewAppletApplicationAdSpaceListDb := implement2.NewAppletApplicationAdSpaceListDb(MasterDb(c)) |
|
|
|
data, _ := NewAppletApplicationAdSpaceListDb.GetAppletApplicationAdSpaceListByAdId(id) |
|
|
|
if data != nil { |
|
|
|
res["name"] = data.Name |
|
|
|
res["state"] = utils.IntToStr(data.State) |
|
|
|
} |
|
|
|
// NewAppletApplicationAdSpaceListDb := implement2.NewAppletApplicationAdSpaceListDb(MasterDb(c)) |
|
|
|
// data, _ := NewAppletApplicationAdSpaceListDb.GetAppletApplicationAdSpaceListByAdId(id) |
|
|
|
// if data != nil { |
|
|
|
// res["name"] = data.Name |
|
|
|
// res["state"] = utils.IntToStr(data.State) |
|
|
|
// } |
|
|
|
return res |
|
|
|
} |