浏览代码

update

master
shenjiachi 4 天前
父节点
当前提交
44d150a466
共有 3 个文件被更改,包括 50 次插入0 次删除
  1. +9
    -0
      src/dao/egg_access_records_dao.go
  2. +33
    -0
      src/implement/egg_access_records_implement.go
  3. +8
    -0
      src/model/egg_access_records.go

+ 9
- 0
src/dao/egg_access_records_dao.go 查看文件

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

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

type EggAccessRecordsDao interface {
//TODO:: You can add specific method definitions here
EggAccessRecordsExist(uid int64, date string, index string) (bool, error)
EggAccessRecordsInsert(m *model.EggAccessRecords) (int64, error)
}

+ 33
- 0
src/implement/egg_access_records_implement.go 查看文件

@@ -0,0 +1,33 @@
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 NewEggAccessRecordsDb(engine *xorm.Engine) dao.EggAccessRecordsDao {
return &EggAccessRecordsDb{Db: engine}
}

type EggAccessRecordsDb struct {
Db *xorm.Engine
}

func (e EggAccessRecordsDb) EggAccessRecordsExist(uid int64, date string, index string) (bool, error) {
var m model.EggAccessRecords
exist, err := e.Db.Where("uid = ?", uid).And("date = ?", date).And("page_index = ?", index).Exist(&m)
if err != nil {
return false, zhios_order_relate_logx.Error(err.Error())
}
return exist, nil
}

func (e EggAccessRecordsDb) EggAccessRecordsInsert(m *model.EggAccessRecords) (int64, error) {
_, err := e.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

+ 8
- 0
src/model/egg_access_records.go 查看文件

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

type EggAccessRecords struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null comment('用户ID') BIGINT(20)"`
PageIndex string `json:"page_index" xorm:"not null comment('页面标识') VARCHAR(50)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('访问日期') CHAR(50)"`
}

正在加载...
取消
保存