diff --git a/src/dao/egg_access_total_dao.go b/src/dao/egg_access_total_dao.go new file mode 100644 index 0000000..824248a --- /dev/null +++ b/src/dao/egg_access_total_dao.go @@ -0,0 +1,8 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type EggAccessTotalDao interface { + //TODO:: You can add specific method definitions here + EggAccessTotalGetByPage(year, week, page, limit int) ([]model.EggAccessTotal, error) +} diff --git a/src/implement/egg_access_total_implement.go b/src/implement/egg_access_total_implement.go new file mode 100644 index 0000000..2284ab8 --- /dev/null +++ b/src/implement/egg_access_total_implement.go @@ -0,0 +1,25 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "xorm.io/xorm" +) + +func NewEggAccessTotalDb(engine *xorm.Engine) dao.EggAccessTotalDao { + return &EggAccessTotalDb{Db: engine} +} + +type EggAccessTotalDb struct { + Db *xorm.Engine +} + +func (e EggAccessTotalDb) EggAccessTotalGetByPage(year, week, page, limit int) ([]model.EggAccessTotal, error) { + var m []model.EggAccessTotal + err := e.Db.Where("year = ?", year).And("week = ?", week).Limit(limit, (page-1)*limit).Find(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err.Error()) + } + return m, nil +} diff --git a/src/model/egg_access_total.go b/src/model/egg_access_total.go new file mode 100644 index 0000000..42ab4a0 --- /dev/null +++ b/src/model/egg_access_total.go @@ -0,0 +1,9 @@ +package model + +type EggAccessTotal struct { + Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Uid int64 `json:"uid" xorm:"not null comment('用户id') BIGINT(20)"` + Total int `json:"total" xorm:"not null comment('访问页面个数') INT(11)"` + Year int `json:"year" xorm:"not null comment('年份') INT(11)"` + Week int `json:"week" xorm:"not null comment('日期') INT(11)"` +}