Browse Source

add access total table

master
shenjiachi 4 days ago
parent
commit
e0ad894125
3 changed files with 42 additions and 0 deletions
  1. +8
    -0
      src/dao/egg_access_total_dao.go
  2. +25
    -0
      src/implement/egg_access_total_implement.go
  3. +9
    -0
      src/model/egg_access_total.go

+ 8
- 0
src/dao/egg_access_total_dao.go View File

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

+ 25
- 0
src/implement/egg_access_total_implement.go View File

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

+ 9
- 0
src/model/egg_access_total.go View File

@@ -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)"`
}

Loading…
Cancel
Save