dengbiao 3 months ago
parent
commit
f52add033c
12 changed files with 152 additions and 11 deletions
  1. +3
    -1
      src/dao/applet_application_ad_space_list_dao.go
  2. +1
    -0
      src/dao/applet_application_dao.go
  3. +25
    -1
      src/implement/applet_application_ad_space_list_implement.go
  4. +11
    -1
      src/implement/applet_application_implement.go
  5. +1
    -0
      src/super/dao/agent_with_medium_dao.go
  6. +7
    -2
      src/super/dao/medium_division_strategy_dao.go
  7. +7
    -2
      src/super/dao/medium_division_strategy_with_agent_flow_dao.go
  8. +3
    -1
      src/super/dao/original_wx_ad_data_dao.go
  9. +11
    -0
      src/super/implement/agent_with_medium_db.go
  10. +27
    -1
      src/super/implement/medium_division_strategy_implement.go
  11. +23
    -1
      src/super/implement/medium_division_strategy_with_agent_flow_implement.go
  12. +33
    -1
      src/super/implement/original_wx_ad_data_implement.go

+ 3
- 1
src/dao/applet_application_ad_space_list_dao.go View File

@@ -3,9 +3,11 @@ package dao
import "code.fnuoos.com/zhimeng/model.git/src/model"

type AppletApplicationAdSpaceListDao interface {
GetAppletApplicationAdSpaceListByAdId(adId string) (medium *model.AppletApplicationAdSpaceList, err error)
FindAppletApplicationAdSpaceListByMediumId(mediumId int) (medium *[]model.AppletApplicationAdSpaceList, err error)
FindAppletApplicationAdSpaceListByIds(id []string) (medium *[]model.AppletApplicationAdSpaceList, err error)
FindAppletApplicationAdSpaceList(name, platform string, state string, mediumId, page, limit int) (list []AppletApplicationAdSpaceListGroup, total int64, err error)
FindAppletApplicationAdSpaceList(name, platform string, adType, state string, mediumId, page, limit int) (list []AppletApplicationAdSpaceListGroup, total int64, err error)
FindAllAppletApplicationAdSpaceListList(appId string) (list []model.AppletApplicationAdSpaceList, err error)
}
type AppletApplicationAdSpaceListGroup struct {
model.AppletApplicationAdSpaceList `xorm:"extends"`


+ 1
- 0
src/dao/applet_application_dao.go View File

@@ -7,4 +7,5 @@ type AppletApplicationDao interface {
FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error)
GetAppletApplicationListByAppid(appId string) (medium *model.AppletApplication, err error)
FindAppletApplicationList(name, platform string, state []string, mediumId, page, limit int) (list []model.AppletApplication, total int64, err error)
FindAllAppletApplicationList() (list []model.AppletApplication, err error)
}

+ 25
- 1
src/implement/applet_application_ad_space_list_implement.go View File

@@ -32,7 +32,7 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceListByMedium
}
return medium, nil
}
func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, platform string, state string, mediumId, page, limit int) (list []dao.AppletApplicationAdSpaceListGroup, total int64, err error) {
func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, platform string, adType, state string, mediumId, page, limit int) (list []dao.AppletApplicationAdSpaceListGroup, total int64, err error) {
sess := a.Db.Where("applet_application_ad_space_list.id>0").Desc("applet_application_ad_space_list.id")
if page > 0 {
sess.Limit(limit, (page-1)*limit)
@@ -46,6 +46,9 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, p
if platform != "" {
sess.And("applet_application.platform = ?", platform)
}
if adType != "" {
sess.And("applet_application_ad_space_list.kind = ?", adType)
}
if state != "" {
sess.And("applet_application_ad_space_list.state = ?", state)
}
@@ -56,3 +59,24 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, p
}
return
}

func (a AppletApplicationAdSpaceListDb) GetAppletApplicationAdSpaceListByAdId(id string) (medium *model.AppletApplicationAdSpaceList, err error) {
medium = new(model.AppletApplicationAdSpaceList)
has, err := a.Db.Where("ad_id =?", id).Get(medium)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return medium, nil
}

func (a AppletApplicationAdSpaceListDb) FindAllAppletApplicationAdSpaceListList(appId string) (list []model.AppletApplicationAdSpaceList, err error) {
sess := a.Db.Where("app_id=?", appId).Desc("id")
err = sess.Find(&list)
if err != nil {
return nil, err
}
return
}

+ 11
- 1
src/implement/applet_application_implement.go View File

@@ -26,6 +26,7 @@ func (a AppletApplicationDb) GetAppletApplicationList(id int) (medium *model.App
}
return medium, nil
}

func (a AppletApplicationDb) FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) {
medium = new([]model.AppletApplication)
err = a.Db.In("id", id).Find(medium)
@@ -47,7 +48,7 @@ func (a AppletApplicationDb) GetAppletApplicationListByAppid(appId string) (medi
}

func (a AppletApplicationDb) FindAppletApplicationList(name, platform string, state []string, mediumId, page, limit int) (list []model.AppletApplication, total int64, err error) {
sess := a.Db.Where("id>0").Desc("id")
sess := a.Db.Desc("id")
if page > 0 {
sess.Limit(limit, (page-1)*limit)
}
@@ -69,3 +70,12 @@ func (a AppletApplicationDb) FindAppletApplicationList(name, platform string, st
}
return
}

func (a AppletApplicationDb) FindAllAppletApplicationList() (list []model.AppletApplication, err error) {
sess := a.Db.Desc("id")
err = sess.Find(&list)
if err != nil {
return nil, err
}
return
}

+ 1
- 0
src/super/dao/agent_with_medium_dao.go View File

@@ -5,6 +5,7 @@ import "code.fnuoos.com/zhimeng/model.git/src/super/model"
type AgentWithMediumDao interface {
FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error)
GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium)
FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error)
}
type AgentWithMediumGroup struct {
model.AgentWithMedium `xorm:"extends"`


+ 7
- 2
src/super/dao/medium_division_strategy_dao.go View File

@@ -1,7 +1,12 @@
package dao
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"
import (
"code.fnuoos.com/zhimeng/model.git/src/super/model"
"xorm.io/xorm"
)

type MediumDivisionStrategyDao interface {
GetOriginalWxAdDataByMediumId(mediumId int) (data *model.MediumDivisionStrategy, err error)
GetOriginalWxAdDataByMediumIdSess(sess *xorm.Session, mediumId int) (data *model.MediumDivisionStrategy, err error)
FindMediumDivisionStrategyList(uuid, mediumId string, page, limit int) (list []model.MediumDivisionStrategy, total int64, err error)
}

+ 7
- 2
src/super/dao/medium_division_strategy_with_agent_flow_dao.go View File

@@ -1,7 +1,12 @@
package dao
package dao

import "code.fnuoos.com/zhimeng/model.git/src/super/model"
import (
"code.fnuoos.com/zhimeng/model.git/src/super/model"
"xorm.io/xorm"
)

type MediumDivisionStrategyWithAgentFlowDao interface {
FindMediumDivisionStrategyWithAgentFlowByStrategyId(strategyId int) (*[]model.MediumDivisionStrategyWithAgentFlow, error)
GetMediumDivisionStrategyWithAgentFlowSess(sess *xorm.Session, strategyId, agentId int) (data *model.MediumDivisionStrategyWithAgentFlow, err error)
GetMediumDivisionStrategyWithAgentFlow(strategyId, agentId int) (data *model.MediumDivisionStrategyWithAgentFlow, err error)
}

+ 3
- 1
src/super/dao/original_wx_ad_data_dao.go View File

@@ -1,4 +1,4 @@
package dao
package dao

import (
"code.fnuoos.com/zhimeng/model.git/src/super/model"
@@ -7,6 +7,8 @@ import (

type OriginalWxAdDataDao interface {
GetOriginalWxAdData(id int) (data *model.OriginalWxAdData, err error)
GetOriginalWxAdDataSess(sess *xorm.Session, id int) (data *model.OriginalWxAdData, err error)
UpdateOriginalWxAdData(m *model.OriginalWxAdData, columns ...string) (int64, error)
UpdateOriginalWxAdDataBySession(session *xorm.Session, m *model.OriginalWxAdData, columns ...string) (int64, error)
FindOriginalWxAdDataList(uuid, appId, slotId, date string, page, limit int) (list []model.OriginalWxAdData, total int64, err error)
}

+ 11
- 0
src/super/implement/agent_with_medium_db.go View File

@@ -44,3 +44,14 @@ func (a AgentWithMediumDb) FindAgentWithMediumList(name, state string, agentId,
}
return
}
func (a AgentWithMediumDb) FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) {
sess := a.Db.Desc("id")
if mediumId > 0 {
sess.And("medium_id = ?", mediumId)
}
err = sess.Find(&list)
if err != nil {
return nil, err
}
return
}

+ 27
- 1
src/super/implement/medium_division_strategy_implement.go View File

@@ -1,9 +1,10 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"strings"
"xorm.io/xorm"
)

@@ -26,3 +27,28 @@ func (m MediumDivisionStrategyDb) GetOriginalWxAdDataByMediumId(mediumId int) (d
}
return data, nil
}
func (m MediumDivisionStrategyDb) GetOriginalWxAdDataByMediumIdSess(sess *xorm.Session, mediumId int) (data *model.MediumDivisionStrategy, err error) {
data = new(model.MediumDivisionStrategy)
has, err := sess.Where("medium_id =?", mediumId).Get(data)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return data, nil
}
func (m MediumDivisionStrategyDb) FindMediumDivisionStrategyList(uuid, mediumId string, page, limit int) (list []model.MediumDivisionStrategy, total int64, err error) {
sess := m.Db.Desc("id").Limit(limit, (page-1)*limit)
if uuid != "" {
sess.And("uuid = ?", uuid)
}
if mediumId != "" {
sess.In("medium_id", strings.Split(mediumId, ","))
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 23
- 1
src/super/implement/medium_division_strategy_with_agent_flow_implement.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
@@ -22,3 +22,25 @@ func (m MediumDivisionStrategyWithAgentFlowDb) FindMediumDivisionStrategyWithAge
}
return &mm, nil
}
func (m MediumDivisionStrategyWithAgentFlowDb) GetMediumDivisionStrategyWithAgentFlowSess(sess *xorm.Session, strategyId, agentId int) (data *model.MediumDivisionStrategyWithAgentFlow, err error) {
data = new(model.MediumDivisionStrategyWithAgentFlow)
has, err := sess.Where("strategy_id=? and agent_id =?", strategyId, agentId).Get(data)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return data, nil
}
func (m MediumDivisionStrategyWithAgentFlowDb) GetMediumDivisionStrategyWithAgentFlow(strategyId, agentId int) (data *model.MediumDivisionStrategyWithAgentFlow, err error) {
data = new(model.MediumDivisionStrategyWithAgentFlow)
has, err := m.Db.Where("strategy_id=? and agent_id =?", strategyId, agentId).Get(data)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return data, nil
}

+ 33
- 1
src/super/implement/original_wx_ad_data_implement.go View File

@@ -1,9 +1,10 @@
package implement
package implement

import (
"code.fnuoos.com/zhimeng/model.git/src/super/dao"
"code.fnuoos.com/zhimeng/model.git/src/super/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"strings"
"xorm.io/xorm"
)

@@ -42,3 +43,34 @@ func (o OriginalWxAdDataDb) GetOriginalWxAdData(id int) (data *model.OriginalWxA
}
return data, nil
}
func (o OriginalWxAdDataDb) GetOriginalWxAdDataSess(sess *xorm.Session, id int) (data *model.OriginalWxAdData, err error) {
data = new(model.OriginalWxAdData)
has, err := sess.Where("id =?", id).Get(data)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return data, nil
}
func (o OriginalWxAdDataDb) FindOriginalWxAdDataList(uuid, appId, slotId, date string, page, limit int) (list []model.OriginalWxAdData, total int64, err error) {
sess := o.Db.OrderBy("date desc,id desc").Limit(limit, (page-1)*limit)
if uuid != "" {
sess.And("uuid = ?", uuid)
}
if date != "" {
sess.In("date", strings.Split(date, ","))
}
if appId != "" {
sess.In("app_id", strings.Split(appId, ","))
}
if slotId != "" {
sess.In("slot_id", strings.Split(slotId, ","))
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

Loading…
Cancel
Save