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

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