dengbiao 4 months ago
parent
commit
7edd972e22
4 changed files with 81 additions and 0 deletions
  1. +12
    -0
      src/dao/happy_orchard_user_watch_records.go
  2. +54
    -0
      src/implement/happy_orchard_user_watch_records.go
  3. +1
    -0
      src/models/happy_orchard_basic_setting.go
  4. +14
    -0
      src/models/happy_orchard_user_watch_records.go

+ 12
- 0
src/dao/happy_orchard_user_watch_records.go View File

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

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

type HappyOrchardUserWatchRecordsDao interface {
GetHappyOrchardUserWatchRecordsSess(sess *xorm.Session, uid int) (m *models.HappyOrchardUserWatchRecords, err error)
GetHappyOrchardUserWatchRecords(uid int) (mm *models.HappyOrchardUserWatchRecords, err error)
HappyOrchardUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *models.HappyOrchardUserWatchRecords, forceColums ...string) (int64, error)
}

+ 54
- 0
src/implement/happy_orchard_user_watch_records.go View File

@@ -0,0 +1,54 @@
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx"
"xorm.io/xorm"
)

type HappyOrchardUserWatchRecordsDb struct {
Db *xorm.Engine
}

func NewHappyOrchardUserWatchRecordsDb(engine *xorm.Engine) dao.HappyOrchardUserWatchRecordsDao {
return &HappyOrchardUserWatchRecordsDb{Db: engine}
}

func (h HappyOrchardUserWatchRecordsDb) GetHappyOrchardUserWatchRecords(uid int) (m *models.HappyOrchardUserWatchRecords, err error) {
m = new(models.HappyOrchardUserWatchRecords)
has, err := h.Db.Where("uid=? ", uid).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (h HappyOrchardUserWatchRecordsDb) GetHappyOrchardUserWatchRecordsSess(sess *xorm.Session, uid int) (m *models.HappyOrchardUserWatchRecords, err error) {
m = new(models.HappyOrchardUserWatchRecords)
has, err := sess.Where("uid=? ", uid).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (h HappyOrchardUserWatchRecordsDb) HappyOrchardUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *models.HappyOrchardUserWatchRecords, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = h.Db.Where("id=?", id).Cols(forceColums...).Update(OneCirclesUserWatchRecords)
} else {
affected, err = h.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 1
- 0
src/models/happy_orchard_basic_setting.go View File

@@ -40,4 +40,5 @@ type HappyOrchardBasicSetting struct {
IsOpenSixEnergyBall int `json:"is_open_six_energy_ball" xorm:"not null default 1 comment('是否开启7日签到(1:开启 0:关闭)') TINYINT(1)"`
SixEnergyBallRewardData string `json:"six_energy_ball_reward_data" xorm:"not null comment('7日签到奖励数据') TEXT"`
VideoSixEnergyBallRewardData string `json:"video_six_energy_ball_reward_data" xorm:"not null comment('观看视频后的7日签到奖励数据') TEXT"`
VideoRewardSystem string `json:"video_reward_system" xorm:"not null comment('视屏奖励机制') TEXT"`
}

+ 14
- 0
src/models/happy_orchard_user_watch_records.go View File

@@ -0,0 +1,14 @@
package models

import (
"time"
)

type HappyOrchardUserWatchRecords struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
NextWatchAdDate time.Time `json:"next_watch_ad_date" xorm:"not null default 'CURRENT_TIMESTAMP' comment('下一轮观看视屏时间') DATETIME"`
ResidueWatchAdNum int `json:"residue_watch_ad_num" xorm:"not null default 0 comment('剩余观看视屏数') INT(11)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Loading…
Cancel
Save