Преглед на файлове

add access total table

master
shenjiachi преди 4 дни
родител
ревизия
e0ad894125
променени са 3 файла, в които са добавени 42 реда и са изтрити 0 реда
  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 Целия файл

@@ -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 Целия файл

@@ -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 Целия файл

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

Зареждане…
Отказ
Запис