|
|
@@ -43,20 +43,23 @@ func (g GenerateWxAdDataDb) GenerateWxAdDataInsertBySession(session *xorm.Sessio |
|
|
|
} |
|
|
|
return insertAffected, nil |
|
|
|
} |
|
|
|
func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { |
|
|
|
func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { |
|
|
|
sess := g.Db.OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) |
|
|
|
if uuid != "" { |
|
|
|
sess.And("uuid = ?", uuid) |
|
|
|
} |
|
|
|
if startDate != "" { |
|
|
|
sess.And("date>=", startDate) |
|
|
|
sess.And("date>=?", startDate) |
|
|
|
} |
|
|
|
if endDate != "" { |
|
|
|
sess.And("date<=", endDate) |
|
|
|
sess.And("date<=?", endDate) |
|
|
|
} |
|
|
|
if appId != "" { |
|
|
|
sess.In("app_id", strings.Split(appId, ",")) |
|
|
|
} |
|
|
|
if mediumId != "" { |
|
|
|
sess.In("medium_id", strings.Split(mediumId, ",")) |
|
|
|
} |
|
|
|
if slotId != "" { |
|
|
|
sess.In("slot_id", strings.Split(slotId, ",")) |
|
|
|
} |
|
|
@@ -66,20 +69,23 @@ func (g GenerateWxAdDataDb) FindGenerateWxAdDataList(uuid, appId, slotId, startD |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { |
|
|
|
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error) { |
|
|
|
sess := g.Db.Where("is_generate_report=1").OrderBy("date desc,id desc").Limit(limit, (page-1)*limit) |
|
|
|
if uuid != "" { |
|
|
|
sess.And("uuid = ?", uuid) |
|
|
|
} |
|
|
|
if startDate != "" { |
|
|
|
sess.And("date>=", startDate) |
|
|
|
sess.And("date>=?", startDate) |
|
|
|
} |
|
|
|
if endDate != "" { |
|
|
|
sess.And("date<=", endDate) |
|
|
|
sess.And("date<=?", endDate) |
|
|
|
} |
|
|
|
if appId != "" { |
|
|
|
sess.In("app_id", strings.Split(appId, ",")) |
|
|
|
} |
|
|
|
if mediumId != "" { |
|
|
|
sess.In("medium_id", strings.Split(mediumId, ",")) |
|
|
|
} |
|
|
|
if slotId != "" { |
|
|
|
sess.In("slot_id", strings.Split(slotId, ",")) |
|
|
|
} |
|
|
@@ -89,3 +95,29 @@ func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMedium(uuid, appId, slotId, |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
func (g GenerateWxAdDataDb) FindGenerateWxAdDataListMediumAll(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, err error) { |
|
|
|
sess := g.Db.Where("is_generate_report=1").OrderBy("date asc,id asc").Limit(limit, (page-1)*limit) |
|
|
|
if uuid != "" { |
|
|
|
sess.And("uuid = ?", uuid) |
|
|
|
} |
|
|
|
if startDate != "" { |
|
|
|
sess.And("date>=?", startDate) |
|
|
|
} |
|
|
|
if endDate != "" { |
|
|
|
sess.And("date<=?", endDate) |
|
|
|
} |
|
|
|
if appId != "" { |
|
|
|
sess.In("app_id", strings.Split(appId, ",")) |
|
|
|
} |
|
|
|
if mediumId != "" { |
|
|
|
sess.In("medium_id", strings.Split(mediumId, ",")) |
|
|
|
} |
|
|
|
if slotId != "" { |
|
|
|
sess.In("slot_id", strings.Split(slotId, ",")) |
|
|
|
} |
|
|
|
err = sess.Find(&list) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return |
|
|
|
} |