Browse Source

git fix

master
dengbiao 4 months ago
parent
commit
bf682f937f
10 changed files with 167 additions and 81 deletions
  1. +13
    -2
      src/dao/applet_application_ad_space_list_dao.go
  2. +10
    -0
      src/dao/applet_application_dao.go
  3. +2
    -1
      src/dao/medium_dao.go
  4. +0
    -10
      src/dao/sys_cfg_dao.go
  5. +36
    -1
      src/implement/applet_application_ad_space_list_implement.go
  6. +71
    -0
      src/implement/applet_application_implement.go
  7. +14
    -0
      src/implement/medium_implement.go
  8. +0
    -66
      src/implement/sys_cfg_implement.go
  9. +17
    -0
      src/model/applet_application.go
  10. +4
    -1
      src/model/applet_application_ad_space_list.go

+ 13
- 2
src/dao/applet_application_ad_space_list_dao.go View File

@@ -1,5 +1,16 @@
package dao
package dao

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

type AppletApplicationAdSpaceListDao interface {
//TODO:: You can add specific method definitions here
FindAppletApplicationAdSpaceListByIds(id []string) (medium *[]model.AppletApplicationAdSpaceList, err error)
FindAppletApplicationAdSpaceList(name, platform string, state string, mediumId, page, limit int) (list []AppletApplicationAdSpaceListGroup, total int64, err error)
}
type AppletApplicationAdSpaceListGroup struct {
model.AppletApplicationAdSpaceList `xorm:"extends"`
model.AppletApplication `xorm:"extends"`
}

func (AppletApplicationAdSpaceListGroup) TableName() string {
return "applet_application_ad_space_list"
}

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

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

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

type AppletApplicationDao interface {
GetAppletApplicationList(id int) (medium *model.AppletApplication, err error)
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)
}

+ 2
- 1
src/dao/medium_dao.go View File

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

import (
"code.fnuoos.com/zhimeng/model.git/src/model"
@@ -14,6 +14,7 @@ type MediumDao interface {
FindAdmin(username string, state, page, limit int) (list []model.Medium, total int64, err error)
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)
}

type MediumWithRolePermissionGroup struct {


+ 0
- 10
src/dao/sys_cfg_dao.go View File

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

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

type SysCfgDao interface {
GetSysCfg(keys string) (m *model.SysCfg, err error)
GetSysCfgStr(keys string) (str string)
FindSysCfg(keys ...string) (m *[]model.SysCfg, err error)
FindSysCfgStr(keys ...string) (str map[string]string)
}

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

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

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

@@ -12,3 +14,36 @@ func NewAppletApplicationAdSpaceListDb(engine *xorm.Engine) dao.AppletApplicatio
type AppletApplicationAdSpaceListDb struct {
Db *xorm.Engine
}

func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceListByIds(id []string) (medium *[]model.AppletApplicationAdSpaceList, err error) {
medium = new([]model.AppletApplicationAdSpaceList)
err = a.Db.In("id", id).Find(medium)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return medium, nil
}
func (a AppletApplicationAdSpaceListDb) FindAppletApplicationAdSpaceList(name, platform string, 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)
}
if mediumId > 0 {
sess.And("applet_application_ad_space_list.medium_id=?", mediumId)
}
if name != "" {
sess.And("applet_application_ad_space_list.name like ? or applet_application_ad_space_list.ad_id like ?", "%"+name+"%", "%"+name+"%")
}
if platform != "" {
sess.And("applet_application.platform = ?", platform)
}
if state != "" {
sess.And("applet_application_ad_space_list.state = ?", state)
}
sess.Join("LEFT", "applet_application", "applet_application.app_id = applet_application_ad_space_list.app_id")
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 71
- 0
src/implement/applet_application_implement.go View File

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

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

func NewAppletApplicationDb(engine *xorm.Engine) dao.AppletApplicationDao {
return &AppletApplicationDb{Db: engine}
}

type AppletApplicationDb struct {
Db *xorm.Engine
}

func (a AppletApplicationDb) GetAppletApplicationList(id int) (medium *model.AppletApplication, err error) {
medium = new(model.AppletApplication)
has, err := a.Db.Where("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 AppletApplicationDb) FindAppletApplicationListByIds(id []string) (medium *[]model.AppletApplication, err error) {
medium = new([]model.AppletApplication)
err = a.Db.In("id", id).Find(medium)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return medium, nil
}
func (a AppletApplicationDb) GetAppletApplicationListByAppid(appId string) (medium *model.AppletApplication, err error) {
medium = new(model.AppletApplication)
has, err := a.Db.Where("app_id =?", appId).Get(medium)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return medium, nil
}

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")
if page > 0 {
sess.Limit(limit, (page-1)*limit)
}
if name != "" {
sess.And("name like ?", "%"+name+"%")
}
if mediumId > 0 {
sess.And("medium_id=?", mediumId)
}
if platform != "" {
sess.And("platform = ?", platform)
}
if len(state) > 0 {
sess.In("state", state)
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 14
- 0
src/implement/medium_implement.go View File

@@ -98,3 +98,17 @@ func (m MediumDb) FindMediumRolePermissionGroup(id int) (list []*dao.MediumWithR
FindAndCount(&list)
return
}
func (m MediumDb) FindSuperAdmin(username, memo 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 username != "" {
sess.And("username like ?", "%"+username+"%")
}
if memo != "" {
sess.And("memo like ?", "%"+memo+"%")
}
total, err = sess.FindAndCount(&list)
if err != nil {
return nil, 0, err
}
return
}

+ 0
- 66
src/implement/sys_cfg_implement.go View File

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

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

func NewSysCfgDb(engine *xorm.Engine) dao.SysCfgDao {
return &SysCfgDb{Db: engine}
}

type SysCfgDb struct {
Db *xorm.Engine
}

func (s SysCfgDb) GetSysCfg(keys string) (sysCfg *model.SysCfg, err error) {
sysCfg = new(model.SysCfg)
has, err := s.Db.Where("`k` =?", keys).Get(sysCfg)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return sysCfg, nil
}
func (s SysCfgDb) GetSysCfgStr(keys string) (str string) {
sysCfg := new(model.SysCfg)
has, err := s.Db.Where("`k` =?", keys).Get(sysCfg)
if err != nil {
return ""
}
if has == false {
return ""
}
return sysCfg.V
}

func (s SysCfgDb) FindSysCfg(keys ...string) (sysCfg *[]model.SysCfg, err error) {
sysCfg = new([]model.SysCfg)
has, err := s.Db.In("`k` ", keys).Get(sysCfg)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return sysCfg, nil
}
func (s SysCfgDb) FindSysCfgStr(keys ...string) (str map[string]string) {
str = make(map[string]string)
for _, v := range keys {
str[v] = ""
}
var sysCfg []model.SysCfg
err := s.Db.In("`k`", keys).Find(&sysCfg)
if err != nil {
return str
}
for _, v := range sysCfg {
str[v.K] = v.V
}
return str
}

+ 17
- 0
src/model/applet_application.go View File

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

import "time"

type AppletApplication struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Platform string `json:"platform" xorm:"comment('平台(微信小程序:wx_applet )') VARCHAR(255)"`
State int `json:"state" xorm:"default 0 comment('审核状态(0待审核 1审核中 2审核成功 3审核失败 4封禁)') TINYINT(1)"`
Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"`
Logo string `json:"logo" xorm:"comment('应用图标') VARCHAR(255)"`
AppId string `json:"app_id" xorm:"comment('小程序appid') VARCHAR(255)"`
OriginalId string `json:"original_id" xorm:"comment('小程序id') VARCHAR(255)"`
Name string `json:"name" xorm:"comment('应用名称') VARCHAR(255)"`
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"`
MediumId int `json:"medium_id" xorm:"not null comment('媒体id') default '0' INT(10)"`
}

+ 4
- 1
src/model/applet_application_ad_space_list.go View File

@@ -8,8 +8,11 @@ type AppletApplicationAdSpaceList struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"default '' comment('广告位名称') VARCHAR(255)"`
AppId string `json:"app_id" xorm:"not null default '' comment('小程序appid') VARCHAR(255)"`
AdId string `json:"ad_id" xorm:"not null default '' comment('广告位id') VARCHAR(255)"`
Kind int `json:"kind" xorm:"not null default 1 comment('广告位类型(1:banner 2:激励视频 3:插屏广告 4:视频广告 5:视频贴片广告)') TINYINT(1)"`
State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝 3:封禁中)') TINYINT(1)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Update time.Time `json:"update" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
MediumId int `json:"medium_id" xorm:"not null comment('媒体id') default '0' INT(10)"`
Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"`
}

Loading…
Cancel
Save