@@ -3,9 +3,11 @@ package dao | |||||
import "code.fnuoos.com/zhimeng/model.git/src/model" | import "code.fnuoos.com/zhimeng/model.git/src/model" | ||||
type AppletApplicationAdSpaceListDao interface { | type AppletApplicationAdSpaceListDao interface { | ||||
GetAppletApplicationAdSpaceListByAdId(adId string) (medium *model.AppletApplicationAdSpaceList, err error) | |||||
FindAppletApplicationAdSpaceListByMediumId(mediumId int) (medium *[]model.AppletApplicationAdSpaceList, err error) | FindAppletApplicationAdSpaceListByMediumId(mediumId int) (medium *[]model.AppletApplicationAdSpaceList, err error) | ||||
FindAppletApplicationAdSpaceListByIds(id []string) (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 { | type AppletApplicationAdSpaceListGroup struct { | ||||
model.AppletApplicationAdSpaceList `xorm:"extends"` | model.AppletApplicationAdSpaceList `xorm:"extends"` | ||||
@@ -7,4 +7,5 @@ type AppletApplicationDao interface { | |||||
FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) | FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) | ||||
GetAppletApplicationListByAppid(appId 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) | FindAppletApplicationList(name, platform string, state []string, mediumId, page, limit int) (list []model.AppletApplication, total int64, err error) | ||||
FindAllAppletApplicationList() (list []model.AppletApplication, err error) | |||||
} | } |
@@ -32,7 +32,7 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceListByMedium | |||||
} | } | ||||
return medium, nil | 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") | sess := a.Db.Where("applet_application_ad_space_list.id>0").Desc("applet_application_ad_space_list.id") | ||||
if page > 0 { | if page > 0 { | ||||
sess.Limit(limit, (page-1)*limit) | sess.Limit(limit, (page-1)*limit) | ||||
@@ -46,6 +46,9 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, p | |||||
if platform != "" { | if platform != "" { | ||||
sess.And("applet_application.platform = ?", platform) | sess.And("applet_application.platform = ?", platform) | ||||
} | } | ||||
if adType != "" { | |||||
sess.And("applet_application_ad_space_list.kind = ?", adType) | |||||
} | |||||
if state != "" { | if state != "" { | ||||
sess.And("applet_application_ad_space_list.state = ?", state) | sess.And("applet_application_ad_space_list.state = ?", state) | ||||
} | } | ||||
@@ -56,3 +59,24 @@ func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, p | |||||
} | } | ||||
return | 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 | |||||
} |
@@ -26,6 +26,7 @@ func (a AppletApplicationDb) GetAppletApplicationList(id int) (medium *model.App | |||||
} | } | ||||
return medium, nil | return medium, nil | ||||
} | } | ||||
func (a AppletApplicationDb) FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) { | func (a AppletApplicationDb) FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) { | ||||
medium = new([]model.AppletApplication) | medium = new([]model.AppletApplication) | ||||
err = a.Db.In("id", id).Find(medium) | 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) { | 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 { | if page > 0 { | ||||
sess.Limit(limit, (page-1)*limit) | sess.Limit(limit, (page-1)*limit) | ||||
} | } | ||||
@@ -69,3 +70,12 @@ func (a AppletApplicationDb) FindAppletApplicationList(name, platform string, st | |||||
} | } | ||||
return | 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 | |||||
} |
@@ -5,6 +5,7 @@ import "code.fnuoos.com/zhimeng/model.git/src/super/model" | |||||
type AgentWithMediumDao interface { | type AgentWithMediumDao interface { | ||||
FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) | FindAgentWithMediumList(name, state string, agentId, mediumId, page, limit int) (list []AgentWithMediumGroup, total int64, err error) | ||||
GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) | GetAgentWithMediumByMediumIdAndAgentId(mediumId, agentId int) (medium *model.AgentWithMedium) | ||||
FindAgentWithMediumListByMediumIdAll(mediumId int) (list []model.AgentWithMedium, err error) | |||||
} | } | ||||
type AgentWithMediumGroup struct { | type AgentWithMediumGroup struct { | ||||
model.AgentWithMedium `xorm:"extends"` | model.AgentWithMedium `xorm:"extends"` | ||||
@@ -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 { | type MediumDivisionStrategyDao interface { | ||||
GetOriginalWxAdDataByMediumId(mediumId int) (data *model.MediumDivisionStrategy, err error) | 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) | |||||
} | } |
@@ -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 { | type MediumDivisionStrategyWithAgentFlowDao interface { | ||||
FindMediumDivisionStrategyWithAgentFlowByStrategyId(strategyId int) (*[]model.MediumDivisionStrategyWithAgentFlow, error) | 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) | |||||
} | } |
@@ -1,4 +1,4 @@ | |||||
package dao | |||||
package dao | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
@@ -7,6 +7,8 @@ import ( | |||||
type OriginalWxAdDataDao interface { | type OriginalWxAdDataDao interface { | ||||
GetOriginalWxAdData(id int) (data *model.OriginalWxAdData, err error) | 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) | UpdateOriginalWxAdData(m *model.OriginalWxAdData, columns ...string) (int64, error) | ||||
UpdateOriginalWxAdDataBySession(session *xorm.Session, 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) | |||||
} | } |
@@ -44,3 +44,14 @@ func (a AgentWithMediumDb) FindAgentWithMediumList(name, state string, agentId, | |||||
} | } | ||||
return | 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 | |||||
} |
@@ -1,9 +1,10 @@ | |||||
package implement | |||||
package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | "code.fnuoos.com/zhimeng/model.git/src/super/dao" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -26,3 +27,28 @@ func (m MediumDivisionStrategyDb) GetOriginalWxAdDataByMediumId(mediumId int) (d | |||||
} | } | ||||
return data, nil | 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 | |||||
} |
@@ -1,4 +1,4 @@ | |||||
package implement | |||||
package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | "code.fnuoos.com/zhimeng/model.git/src/super/dao" | ||||
@@ -22,3 +22,25 @@ func (m MediumDivisionStrategyWithAgentFlowDb) FindMediumDivisionStrategyWithAge | |||||
} | } | ||||
return &mm, nil | 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 | |||||
} |
@@ -1,9 +1,10 @@ | |||||
package implement | |||||
package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/dao" | "code.fnuoos.com/zhimeng/model.git/src/super/dao" | ||||
"code.fnuoos.com/zhimeng/model.git/src/super/model" | "code.fnuoos.com/zhimeng/model.git/src/super/model" | ||||
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" | ||||
"strings" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -42,3 +43,34 @@ func (o OriginalWxAdDataDb) GetOriginalWxAdData(id int) (data *model.OriginalWxA | |||||
} | } | ||||
return data, nil | 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 | |||||
} |