Browse Source

update

master
dengbiao 7 months ago
parent
commit
9b05ec0caa
9 changed files with 141 additions and 10 deletions
  1. +9
    -0
      src/dao/happy_orchard_user_assistance_records_dao.go
  2. +1
    -0
      src/dao/happy_orchard_user_waters_dao.go
  3. +11
    -0
      src/dao/happy_orchard_user_waters_log_dao.go
  4. +52
    -0
      src/implement/happy_orchard_user_assistance_records_db.go
  5. +24
    -8
      src/implement/happy_orchard_user_waters_db.go
  6. +31
    -0
      src/implement/happy_orchard_user_waters_log_db.go
  7. +11
    -0
      src/models/happy_orchard_user_assistance_records.go
  8. +1
    -1
      src/models/happy_orchard_user_waters.go
  9. +1
    -1
      src/models/happy_orchard_user_waters_log.go

+ 9
- 0
src/dao/happy_orchard_user_assistance_records_dao.go View File

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

import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"

type HappyOrchardUserAssistanceRecordsDao interface {
GetHappyOrchardUserAssistanceRecords(uid int, kind int32) (m *models.HappyOrchardUserAssistanceRecords, err error)
InsertHappyOrchardUserAssistanceRecords(m *models.HappyOrchardUserAssistanceRecords) (int, error)
UpdateHappyOrchardUserAssistanceRecords(m *models.HappyOrchardUserAssistanceRecords, forceColums ...string) (int64, error)
}

+ 1
- 0
src/dao/happy_orchard_user_waters_dao.go View File

@@ -8,4 +8,5 @@ type HappyOrchardUserWatersDao interface {
GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error)
GetHappyOrchardUserWatersSess(uid int) (m *models.HappyOrchardUserWaters, err error)
UpdateHappyOrchardUserWaters(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error)
UpdateHappyOrchardUserWatersBySess(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error)
}

+ 11
- 0
src/dao/happy_orchard_user_waters_log_dao.go View File

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

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

type HappyOrchardUserWatersLogDao interface {
InsertHappyOrchardUserWatersLog(m *models.HappyOrchardUserWatersLog) (int, error)
InsertHappyOrchardUserWatersLogBySess(session *xorm.Session, m *models.HappyOrchardUserWatersLog) (int, error)
}

+ 52
- 0
src/implement/happy_orchard_user_assistance_records_db.go View File

@@ -0,0 +1,52 @@
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 HappyOrchardUserAssistanceRecordsDb struct {
Db *xorm.Engine
}

func (h HappyOrchardUserAssistanceRecordsDb) GetHappyOrchardUserAssistanceRecords(uid int, kind int32) (m *models.HappyOrchardUserAssistanceRecords, err error) {
m = new(models.HappyOrchardUserAssistanceRecords)
has, err := h.Db.Where("uid =?", uid).And("kind =?", kind).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (h HappyOrchardUserAssistanceRecordsDb) InsertHappyOrchardUserAssistanceRecords(m *models.HappyOrchardUserAssistanceRecords) (int, error) {
_, err := h.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (h HappyOrchardUserAssistanceRecordsDb) UpdateHappyOrchardUserAssistanceRecords(m *models.HappyOrchardUserAssistanceRecords, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = h.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m)
} else {
affected, err = h.Db.Where("id=?", m.Id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func NewHappyOrchardUserAssistanceRecordsDb(engine *xorm.Engine) dao.HappyOrchardUserAssistanceRecordsDao {
return &HappyOrchardUserAssistanceRecordsDb{Db: engine}
}

+ 24
- 8
src/implement/happy_orchard_user_waters_db.go View File

@@ -12,6 +12,22 @@ type HappyOrchardUserWatersDb struct {
Sess *xorm.Session
}

func (h HappyOrchardUserWatersDb) UpdateHappyOrchardUserWatersBySess(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = h.Sess.Where("uid=?", uid).Cols(forceColums...).Update(m)
} else {
affected, err = h.Sess.Where("uid=?", uid).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (h HappyOrchardUserWatersDb) UpdateHappyOrchardUserWaters(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error) {
var (
affected int64
@@ -28,14 +44,6 @@ func (h HappyOrchardUserWatersDb) UpdateHappyOrchardUserWaters(uid int, m *model
return affected, nil
}

func NewHappyOrchardUserWatersDb(engine *xorm.Engine) dao.HappyOrchardUserWatersDao {
return &HappyOrchardUserWatersDb{Db: engine}
}

func NewHappyOrchardUserWatersSess(sess *xorm.Session) dao.HappyOrchardUserWatersDao {
return &HappyOrchardUserWatersDb{Sess: sess}
}

func (h HappyOrchardUserWatersDb) GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) {
m = new(models.HappyOrchardUserWaters)
has, err := h.Db.Where("uid =?", uid).Get(m)
@@ -58,3 +66,11 @@ func (h HappyOrchardUserWatersDb) GetHappyOrchardUserWatersSess(uid int) (m *mod
}
return m, nil
}

func NewHappyOrchardUserWatersDb(engine *xorm.Engine) dao.HappyOrchardUserWatersDao {
return &HappyOrchardUserWatersDb{Db: engine}
}

func NewHappyOrchardUserWatersSess(sess *xorm.Session) dao.HappyOrchardUserWatersDao {
return &HappyOrchardUserWatersDb{Sess: sess}
}

+ 31
- 0
src/implement/happy_orchard_user_waters_log_db.go View File

@@ -0,0 +1,31 @@
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"
"xorm.io/xorm"
)

type HappyOrchardUserWatersLogDb struct {
Db *xorm.Engine
}

func (h HappyOrchardUserWatersLogDb) InsertHappyOrchardUserWatersLog(m *models.HappyOrchardUserWatersLog) (int, error) {
_, err := h.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func (h HappyOrchardUserWatersLogDb) InsertHappyOrchardUserWatersLogBySess(session *xorm.Session, m *models.HappyOrchardUserWatersLog) (int, error) {
_, err := session.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

func NewHappyOrchardUserWatersLogDb(engine *xorm.Engine) dao.HappyOrchardUserWatersLogDao {
return &HappyOrchardUserWatersLogDb{Db: engine}
}

+ 11
- 0
src/models/happy_orchard_user_assistance_records.go View File

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

type HappyOrchardUserAssistanceRecords struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
Uid int `json:"uid" xorm:"not null default '' comment('用户id') INT(11)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') INT(11)"`
Nums int `json:"nums" xorm:"not null default 0 comment('助力次数') INT(11)"`
Kind int32 `json:"kind" xorm:"not null default 1 comment('类型(1:分享助力 2:玩金蛋游戏助力 3:玩抽奖游戏助力)') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

+ 1
- 1
src/models/happy_orchard_user_waters.go View File

@@ -2,7 +2,7 @@ package models

type HappyOrchardUserWaters struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
Uid string `json:"uid" xorm:"not null default '' comment('名称') VARCHAR(255)"`
Uid int `json:"uid" xorm:"not null default '' comment('名称') VARCHAR(255)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('水滴数') INT(11)"`
ReplaceSeedNums int `json:"replace_seed_nums" xorm:"not null default 0 comment('更换种子次数') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`


+ 1
- 1
src/models/happy_orchard_user_waters_log.go View File

@@ -2,7 +2,7 @@ package models

type HappyOrchardUserWatersLog struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
Uid string `json:"uid" xorm:"not null default '' comment('名称') VARCHAR(255)"`
Uid int `json:"uid" xorm:"not null default '' comment('名称') VARCHAR(255)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('水滴数') INT(11)"`
Title string `json:"title" xorm:"not null default '' comment('名称') CHAR(50)"`
Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:增加 2:减少)') TINYINT(1)"`


Loading…
Cancel
Save