From f0ac655b8bf374674dcb18a6179fa00925aa2b46 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 4 Dec 2024 16:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E5=89=A7=E7=9F=AD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=A7=82=E7=9C=8B=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/playlet_total_dao.go | 7 ++++++ src/dao/video_total_dao.go | 7 ++++++ src/implement/playlet_total_implement.go | 28 ++++++++++++++++++++++++ src/implement/video_total_implement.go | 28 ++++++++++++++++++++++++ src/model/playlet_total.go | 13 +++++++++++ src/model/video_total.go | 13 +++++++++++ 6 files changed, 96 insertions(+) create mode 100644 src/dao/playlet_total_dao.go create mode 100644 src/dao/video_total_dao.go create mode 100644 src/implement/playlet_total_implement.go create mode 100644 src/implement/video_total_implement.go create mode 100644 src/model/playlet_total.go create mode 100644 src/model/video_total.go diff --git a/src/dao/playlet_total_dao.go b/src/dao/playlet_total_dao.go new file mode 100644 index 0000000..073c30d --- /dev/null +++ b/src/dao/playlet_total_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type PlayletTotalDao interface { + GetPlayletTotal(uid, date string) (m *model.PlayletTotal, err error) +} diff --git a/src/dao/video_total_dao.go b/src/dao/video_total_dao.go new file mode 100644 index 0000000..29fccb6 --- /dev/null +++ b/src/dao/video_total_dao.go @@ -0,0 +1,7 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type VideoTotalDao interface { + GetVideoTotal(uid, date string) (m *model.VideoTotal, err error) +} diff --git a/src/implement/playlet_total_implement.go b/src/implement/playlet_total_implement.go new file mode 100644 index 0000000..7b7f565 --- /dev/null +++ b/src/implement/playlet_total_implement.go @@ -0,0 +1,28 @@ +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 NewPlayletTotalDb(engine *xorm.Engine) dao.PlayletTotalDao { + return &PlayletTotalDb{Db: engine} +} + +type PlayletTotalDb struct { + Db *xorm.Engine +} + +func (p PlayletTotalDb) GetPlayletTotal(uid, date string) (m *model.PlayletTotal, err error) { + m = new(model.PlayletTotal) + has, err := p.Db.Where("uid=? and date=?", uid, date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/implement/video_total_implement.go b/src/implement/video_total_implement.go new file mode 100644 index 0000000..d1ba2ff --- /dev/null +++ b/src/implement/video_total_implement.go @@ -0,0 +1,28 @@ +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 NewVideoTotalDb(engine *xorm.Engine) dao.VideoTotalDao { + return &VideoTotalDb{Db: engine} +} + +type VideoTotalDb struct { + Db *xorm.Engine +} + +func (v VideoTotalDb) GetVideoTotal(uid, date string) (m *model.VideoTotal, err error) { + m = new(model.VideoTotal) + has, err := v.Db.Where("uid=? and date=?", uid, date).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/model/playlet_total.go b/src/model/playlet_total.go new file mode 100644 index 0000000..ff12c66 --- /dev/null +++ b/src/model/playlet_total.go @@ -0,0 +1,13 @@ +package model + +import ( + "time" +) + +type PlayletTotal struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"INT(11)"` + Date int `json:"date" xorm:"default 0 INT(11)"` + Time time.Time `json:"time" xorm:"DATETIME"` + Total int `json:"total" xorm:"default 0 INT(11)"` +} diff --git a/src/model/video_total.go b/src/model/video_total.go new file mode 100644 index 0000000..adc30c8 --- /dev/null +++ b/src/model/video_total.go @@ -0,0 +1,13 @@ +package model + +import ( + "time" +) + +type VideoTotal struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"INT(11)"` + Date int `json:"date" xorm:"default 0 INT(11)"` + Time time.Time `json:"time" xorm:"DATETIME"` + Total int `json:"total" xorm:"default 0 INT(11)"` +}