Bläddra i källkod

后台操作日志

master
huangjiajun 21 timmar sedan
förälder
incheckning
ac9cda7c7f
2 ändrade filer med 48 tillägg och 0 borttagningar
  1. +7
    -0
      src/dao/admin_log_dao.go
  2. +41
    -0
      src/implement/admin_log_implement.go

+ 7
- 0
src/dao/admin_log_dao.go Visa fil

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

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type AdminLogDao interface {
FindAdminLogAndTotal(page, limit, types, memo, startTime, endTime string) (*[]model.AdminLog, int64, error)
}

+ 41
- 0
src/implement/admin_log_implement.go Visa fil

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

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

func NewAdminLogDb(engine *xorm.Engine) dao.AdminLogDao {
return &AdminLogDb{Db: engine}
}

type AdminLogDb struct {
Db *xorm.Engine
}

func (a AdminLogDb) FindAdminLogAndTotal(page, limit, types, memo, startTime, endTime string) (*[]model.AdminLog, int64, error) {
var m []model.AdminLog
sess := a.Db.Where("1=1")

if startTime != "" {
sess.And("time>=?", startTime)
}
if endTime != "" {
sess.And("time<=?", endTime)
}
if types != "" {
sess.And("type=?", types)
}
if memo != "" {
sess.And("memo like ?", "%"+memo+"%")
}
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m)
if err != nil {
return nil, count, zhios_order_relate_logx.Error(err)
}
return &m, count, nil
}

Laddar…
Avbryt
Spara