dengbiao há 1 mês
ascendente
cometimento
09a776d299
21 ficheiros alterados com 162 adições e 26 eliminações
  1. +9
    -0
      src/dao/admin_bind_medium_dao.go
  2. +2
    -1
      src/dao/admin_dao.go
  3. +1
    -0
      src/dao/medium_dao.go
  4. +44
    -0
      src/implement/admin_bind_medium_implement.go
  5. +12
    -1
      src/implement/admin_implement.go
  6. +12
    -0
      src/implement/medium_implement.go
  7. +2
    -2
      src/implement/permission_group_implement.go
  8. +13
    -0
      src/model/admin_bind_medium.go
  9. +1
    -0
      src/model/permission_group.go
  10. +3
    -2
      src/super/dao/generate_wx_ad_data_dao.go
  11. +1
    -1
      src/super/dao/medium_bank_info_dao.go
  12. +1
    -1
      src/super/dao/medium_contact_info_dao.go
  13. +1
    -1
      src/super/dao/medium_list_dao.go
  14. +2
    -2
      src/super/implement/agent_settlement_implement.go
  15. +38
    -6
      src/super/implement/generate_wx_ad_data_implement.go
  16. +2
    -2
      src/super/implement/master_data_statistics_implement.go
  17. +5
    -1
      src/super/implement/medium_bank_info_db.go
  18. +5
    -1
      src/super/implement/medium_contact_info_db.go
  19. +4
    -1
      src/super/implement/medium_list_implement.go
  20. +2
    -2
      src/super/implement/medium_settlement_implement.go
  21. +2
    -2
      src/super/implement/original_wx_ad_data_implement.go

+ 9
- 0
src/dao/admin_bind_medium_dao.go Ver ficheiro

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/zhimeng/model.git/src/model"

type AdminBindMediumDao interface {
FindAll(adminId int) (list []model.AdminBindMedium)
FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error)
GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium)
}

+ 2
- 1
src/dao/admin_dao.go Ver ficheiro

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

import (
"code.fnuoos.com/zhimeng/model.git/src/model"
@@ -9,6 +9,7 @@ type AdminDao interface {
CreateAdminId() (admId int, err error)
AdminDeleteBySession(session *xorm.Session, admId interface{}) (int64, error)
GetAdmin(id int) (m *model.Admin, err error)
GetSuperAdmin() (m *model.Admin, err error)
GetAdminByUserName(userName string) (m *model.Admin, err error)
GetAdminRolePermission(admId int) (list []*AdminRolePermission, total int64, err error)
FindAdmin(username string, state, page, limit int) (list []model.Admin, total int64, err error)


+ 1
- 0
src/dao/medium_dao.go Ver ficheiro

@@ -15,6 +15,7 @@ type MediumDao interface {
GetMedium(id int) (m *model.Medium, err error)
FindMediumRolePermissionGroup(id int) (list []*MediumWithRolePermissionGroup, total int64, err error)
FindSuperAdmin(username, memo string, page, limit int) (list []model.Medium, total int64, err error)
FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error)
GetSuperAdmin(mediumId int) (list *model.Medium)
}



+ 44
- 0
src/implement/admin_bind_medium_implement.go Ver ficheiro

@@ -0,0 +1,44 @@
package implement

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

func NewAdminBindMediumDb(engine *xorm.Engine) dao.AdminBindMediumDao {
return &AdminBindMediumDb{Db: engine}
}

type AdminBindMediumDb struct {
Db *xorm.Engine
}

func (a AdminBindMediumDb) FindAll(adminId int) (list []model.AdminBindMedium) {
sess := a.Db.Where("admin_id=?", adminId)
err := sess.Find(&list)
if err != nil {
return nil
}
return
}
func (a AdminBindMediumDb) GetAdminByMediumId(adminId, mediumId int) (list *model.AdminBindMedium) {
sess := a.Db.Where("medium_id=? and admin_id=?", mediumId, adminId)
get, err := sess.Get(&list)
if get == false || err != nil {
return nil
}
return
}
func (a AdminBindMediumDb) FindMediumList(mediumId string, adminId, page, limit int) (list []model.AdminBindMedium, total int64, err error) {
sess := a.Db.Where("admin_id=?", adminId).Desc("id").Limit(limit, (page-1)*limit)
if mediumId != "" {
sess.In("medium_id", strings.Split(mediumId, ","))
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 12
- 1
src/implement/admin_implement.go Ver ficheiro

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

import (
"code.fnuoos.com/zhimeng/model.git/src/dao"
@@ -48,6 +48,17 @@ func (a AdminDb) GetAdmin(id int) (m *model.Admin, err error) {
}
return m, nil
}
func (a AdminDb) GetSuperAdmin() (m *model.Admin, err error) {
m = new(model.Admin)
has, err := a.Db.Where("is_super_administrator =?", 1).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (a AdminDb) GetAdminByUserName(userName string) (m *model.Admin, err error) {
m = new(model.Admin)


+ 12
- 0
src/implement/medium_implement.go Ver ficheiro

@@ -5,6 +5,7 @@ import (
"code.fnuoos.com/zhimeng/model.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx"
"reflect"
"strings"
"xorm.io/xorm"
)

@@ -112,6 +113,17 @@ func (m MediumDb) FindSuperAdmin(username, memo string, page, limit int) (list [
}
return
}
func (m MediumDb) FindSuperAdminByMediumId(mediumId string, page, limit int) (list []model.Medium, total int64, err error) {
sess := m.Db.Where("is_super_administrator=1").Desc("id").Limit(limit, (page-1)*limit)
if mediumId != "" {
sess.In("medium_id", strings.Split(mediumId, ","))
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}
func (m MediumDb) GetSuperAdmin(mediumId int) (list *model.Medium) {
list = new(model.Medium)
sess := m.Db.Where("is_super_administrator=1 and medium_id=?", mediumId)


+ 2
- 2
src/implement/permission_group_implement.go Ver ficheiro

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

import (
"code.fnuoos.com/zhimeng/model.git/enum"
@@ -26,7 +26,7 @@ func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, erro

func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
var m []model.PermissionGroup
if err := p.Db.Asc("id").Find(&m); err != nil {
if err := p.Db.OrderBy("sort desc,id asc").Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil


+ 13
- 0
src/model/admin_bind_medium.go Ver ficheiro

@@ -0,0 +1,13 @@
package model

import (
"time"
)

type AdminBindMedium struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
AdminId int `json:"admin_id" xorm:"default 0 comment('管理员id') INT(11)"`
MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"`
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP DATETIME"`
}

+ 1
- 0
src/model/permission_group.go Ver ficheiro

@@ -8,4 +8,5 @@ type PermissionGroup struct {
State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Sort int `json:"sort" xorm:"not null default 0 comment('') INT(11)"`
}

+ 3
- 2
src/super/dao/generate_wx_ad_data_dao.go Ver ficheiro

@@ -9,6 +9,7 @@ type GenerateWxAdDataDao interface {
GenerateWxAdDataInsertBySession(session *xorm.Session, m *model.GenerateWxAdData) (int64, error)
GetGenerateWxAdData(id int) (data *model.GenerateWxAdData, err error)
UpdateGenerateWxAdDataBySession(session *xorm.Session, m *model.GenerateWxAdData, columns ...string) (int64, error)
FindGenerateWxAdDataList(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error)
FindGenerateWxAdDataListMedium(uuid, appId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error)
FindGenerateWxAdDataList(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error)
FindGenerateWxAdDataListMedium(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, total int64, err error)
FindGenerateWxAdDataListMediumAll(uuid, appId, mediumId, slotId, startDate, endDate string, page, limit int) (list []model.GenerateWxAdData, err error)
}

+ 1
- 1
src/super/dao/medium_bank_info_dao.go Ver ficheiro

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

type MediumBankInfoDao interface {
GetMediumBankInfoList(MediumId int) (medium *model.MediumBankInfo, err error)
FindMediumBankInfoList(uuid, name, state string, page, limit int) (list []MediumBankInfoGroup, total int64, err error)
FindMediumBankInfoList(uuid, name, mediumId, state string, page, limit int) (list []MediumBankInfoGroup, total int64, err error)
}
type MediumBankInfoGroup struct {
model.MediumBankInfo `xorm:"extends"`


+ 1
- 1
src/super/dao/medium_contact_info_dao.go Ver ficheiro

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

type MediumContactInfoDao interface {
GetMediumContactInfoList(MediumId int) (medium *model.MediumContactInfo, err error)
FindMediumContactInfoList(uuid, name, state string, page, limit int) (list []MediumContactInfoGroup, total int64, err error)
FindMediumContactInfoList(uuid, name, mediumId, state string, page, limit int) (list []MediumContactInfoGroup, total int64, err error)
}
type MediumContactInfoGroup struct {
model.MediumContactInfo `xorm:"extends"`


+ 1
- 1
src/super/dao/medium_list_dao.go Ver ficheiro

@@ -10,6 +10,6 @@ type MediumListDao interface {
GetMediumListBySession(session *xorm.Session, mediumId int) (medium *model.MediumList, err error)
MediumListInsert(m *model.MediumList) (int64, error)
UpdateMediumList(m *model.MediumList, columns ...string) (int64, error)
FindMediumList(uuid, name, state string, minState, page, limit int) (list []model.MediumList, total int64, err error)
FindMediumList(uuid, name, mediumId, state string, minState, page, limit int) (list []model.MediumList, total int64, err error)
FindMediumListBySettleType(uuid, mediumId, settleType string, page, limit int) (list []model.MediumList, total int64, err error)
}

+ 2
- 2
src/super/implement/agent_settlement_implement.go Ver ficheiro

@@ -67,10 +67,10 @@ func (a AgentSettlementDb) FindAgentSettlementList(uuid, agentId, appId, payStat
sess.And("state = ?", state)
}
if startDate != "" {
sess.And("start_date>=", startDate)
sess.And("start_date>=?", startDate)
}
if endDate != "" {
sess.And("end_date<=", endDate)
sess.And("end_date<=?", endDate)
}
if appId != "" {
sess.In("app_id", strings.Split(appId, ","))


+ 38
- 6
src/super/implement/generate_wx_ad_data_implement.go Ver ficheiro

@@ -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
}

+ 2
- 2
src/super/implement/master_data_statistics_implement.go Ver ficheiro

@@ -57,10 +57,10 @@ func (m MasterDataStatisticsDb) FindMasterDataStatisticsList(uuid, startDate, en
sess.And("uuid = ?", uuid)
}
if startDate != "" {
sess.And("date>=", startDate)
sess.And("date>=?", startDate)
}
if endDate != "" {
sess.And("date<=", endDate)
sess.And("date<=?", endDate)
}
total, err = sess.FindAndCount(&list)
if err != nil {


+ 5
- 1
src/super/implement/medium_bank_info_db.go Ver ficheiro

@@ -4,6 +4,7 @@ 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,8 +27,11 @@ func (a MediumBankInfoDb) GetMediumBankInfoList(MediumId int) (medium *model.Med
}
return medium, nil
}
func (a MediumBankInfoDb) FindMediumBankInfoList(uuid, name, state string, page, limit int) (list []dao.MediumBankInfoGroup, total int64, err error) {
func (a MediumBankInfoDb) FindMediumBankInfoList(uuid, name, mediumId, state string, page, limit int) (list []dao.MediumBankInfoGroup, total int64, err error) {
sess := a.Db.Where("medium_bank_info.state>0").Desc("medium_bank_info.id").Limit(limit, (page-1)*limit)
if mediumId != "" {
sess.In("medium_list.medium_id", strings.Split(mediumId, ","))
}
if name != "" {
sess.And("medium_list.company_name like ?", "%"+name+"%")
}


+ 5
- 1
src/super/implement/medium_contact_info_db.go Ver ficheiro

@@ -4,6 +4,7 @@ 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,8 +27,11 @@ func (a MediumContactInfoDb) GetMediumContactInfoList(MediumId int) (medium *mod
}
return medium, nil
}
func (a MediumContactInfoDb) FindMediumContactInfoList(uuid, name, state string, page, limit int) (list []dao.MediumContactInfoGroup, total int64, err error) {
func (a MediumContactInfoDb) FindMediumContactInfoList(uuid, name, mediumId, state string, page, limit int) (list []dao.MediumContactInfoGroup, total int64, err error) {
sess := a.Db.Where("medium_contact_info.state>0").Desc("medium_contact_info.id").Limit(limit, (page-1)*limit)
if mediumId != "" {
sess.In("medium_list.medium_id", strings.Split(mediumId, ","))
}
if name != "" {
sess.And("medium_list.company_name like ?", "%"+name+"%")
}


+ 4
- 1
src/super/implement/medium_list_implement.go Ver ficheiro

@@ -52,8 +52,11 @@ func (m MediumListDb) UpdateMediumList(medium *model.MediumList, columns ...stri
}
return affected, nil
}
func (m MediumListDb) FindMediumList(uuid, name, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) {
func (m MediumListDb) FindMediumList(uuid, name, mediumId, state string, minState, page, limit int) (list []model.MediumList, total int64, err error) {
sess := m.Db.Desc("id").Limit(limit, (page-1)*limit)
if mediumId != "" {
sess.In("medium_id", strings.Split(mediumId, ","))
}
if name != "" {
sess.And("company_name like ?", "%"+name+"%")
}


+ 2
- 2
src/super/implement/medium_settlement_implement.go Ver ficheiro

@@ -66,10 +66,10 @@ func (m MediumSettlementDb) FindMediumSettlementList(uuid, mediumId, appId, payS
sess.And("state = ?", state)
}
if startDate != "" {
sess.And("start_date>=", startDate)
sess.And("start_date>=?", startDate)
}
if endDate != "" {
sess.And("end_date<=", endDate)
sess.And("end_date<=?", endDate)
}
if appId != "" {
sess.In("app_id", strings.Split(appId, ","))


+ 2
- 2
src/super/implement/original_wx_ad_data_implement.go Ver ficheiro

@@ -60,10 +60,10 @@ func (o OriginalWxAdDataDb) FindOriginalWxAdDataList(uuid, appId, slotId, startD
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, ","))


Carregando…
Cancelar
Guardar