@@ -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) | |||||
} |
@@ -8,4 +8,5 @@ type HappyOrchardUserWatersDao interface { | |||||
GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) | GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) | ||||
GetHappyOrchardUserWatersSess(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) | UpdateHappyOrchardUserWaters(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error) | ||||
UpdateHappyOrchardUserWatersBySess(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error) | |||||
} | } |
@@ -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) | |||||
} |
@@ -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} | |||||
} |
@@ -12,6 +12,22 @@ type HappyOrchardUserWatersDb struct { | |||||
Sess *xorm.Session | 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) { | func (h HappyOrchardUserWatersDb) UpdateHappyOrchardUserWaters(uid int, m *models.HappyOrchardUserWaters, forceColums ...string) (int64, error) { | ||||
var ( | var ( | ||||
affected int64 | affected int64 | ||||
@@ -28,14 +44,6 @@ func (h HappyOrchardUserWatersDb) UpdateHappyOrchardUserWaters(uid int, m *model | |||||
return affected, nil | 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) { | func (h HappyOrchardUserWatersDb) GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error) { | ||||
m = new(models.HappyOrchardUserWaters) | m = new(models.HappyOrchardUserWaters) | ||||
has, err := h.Db.Where("uid =?", uid).Get(m) | has, err := h.Db.Where("uid =?", uid).Get(m) | ||||
@@ -58,3 +66,11 @@ func (h HappyOrchardUserWatersDb) GetHappyOrchardUserWatersSess(uid int) (m *mod | |||||
} | } | ||||
return m, nil | 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} | |||||
} |
@@ -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} | |||||
} |
@@ -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"` | |||||
} |
@@ -2,7 +2,7 @@ package models | |||||
type HappyOrchardUserWaters struct { | type HappyOrchardUserWaters struct { | ||||
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"` | 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)"` | 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)"` | 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"` | CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` | ||||
@@ -2,7 +2,7 @@ package models | |||||
type HappyOrchardUserWatersLog struct { | type HappyOrchardUserWatersLog struct { | ||||
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"` | 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)"` | WaterNums int `json:"water_nums" xorm:"not null default 0 comment('水滴数') INT(11)"` | ||||
Title string `json:"title" xorm:"not null default '' comment('名称') CHAR(50)"` | 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)"` | Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:增加 2:减少)') TINYINT(1)"` | ||||