Browse Source

update

master
dengbiao 7 months ago
parent
commit
724dfb9ba9
21 changed files with 296 additions and 9 deletions
  1. +6
    -2
      go.mod
  2. +9
    -0
      src/dao/happy_happy_orchard_basic_setting_dao.go
  3. +2
    -0
      src/dao/happy_happy_orchard_reward_dao.go
  4. +10
    -0
      src/dao/happy_happy_orchard_sign_day_dao.go
  5. +3
    -0
      src/dao/happy_orchard_reward_exchange_records_dao.go
  6. +8
    -0
      src/dao/happy_orchard_reward_with_seed_dao.go
  7. +1
    -0
      src/dao/happy_orchard_seed_dao.go
  8. +14
    -0
      src/dao/happy_orchard_seed_record_dao.go
  9. +1
    -0
      src/dao/happy_orchard_user_waters_dao.go
  10. +6
    -6
      src/implement/happy_orchard_basic_setting_db.go
  11. +14
    -0
      src/implement/happy_orchard_reward_db.go
  12. +33
    -0
      src/implement/happy_orchard_reward_exchange_records_db.go
  13. +35
    -0
      src/implement/happy_orchard_reward_with_seed_db.go
  14. +7
    -0
      src/implement/happy_orchard_seed_db.go
  15. +43
    -0
      src/implement/happy_orchard_sign_day_db.go
  16. +60
    -0
      src/implement/happy_orchard_user_seed_record_db.go
  17. +17
    -1
      src/implement/happy_orchard_user_waters_db.go
  18. +1
    -0
      src/models/happy_orchard_basic_setting.go
  19. +1
    -0
      src/models/happy_orchard_reward_exchange_records.go
  20. +10
    -0
      src/models/happy_orchard_sign_day.go
  21. +15
    -0
      src/models/happy_orchard_user_seed_record.go

+ 6
- 2
go.mod View File

@@ -3,7 +3,8 @@ module code.fnuoos.com/go_rely_warehouse/zyos_model.git
go 1.19

require (
github.com/gin-gonic/gin v1.9.1
github.com/go-sql-driver/mysql v1.8.1
github.com/syyongx/php2go v0.9.8
go.uber.org/zap v1.13.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
@@ -12,16 +13,19 @@ require (

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 // indirect
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect
)

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

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

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

type HappyOrchardBasicSettingDao interface {
GetHappyOrchardBasicSetting() (m *models.HappyOrchardBasicSetting, err error)
}

+ 2
- 0
src/dao/happy_happy_orchard_reward_dao.go View File

@@ -6,4 +6,6 @@ import (

type HappyOrchardRewardDao interface {
GetHappyOrchardReward(id int) (m *models.HappyOrchardReward, err error)
FindHappyOrchardRewardById(seedId []int) (m *[]models.HappyOrchardReward, err error)
FindHappyOrchardRewardAll(rewardIds []int, start, limit int) (mm *[]models.HappyOrchardReward, err error)
}

+ 10
- 0
src/dao/happy_happy_orchard_sign_day_dao.go View File

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

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

type HappyOrchardSignDayDao interface {
GetHappyOrchardSignDay(uid int) (m *models.HappyOrchardSignDay, err error)
GetHappyOrchardSignDaySess(uid int) (m *models.HappyOrchardSignDay, err error)
}

+ 3
- 0
src/dao/happy_orchard_reward_exchange_records_dao.go View File

@@ -7,4 +7,7 @@ import (
type HappyOrchardRewardExchangeRecordsDao interface {
GetHappyOrchardRewardExchangeRecords(id int) (m *models.HappyOrchardRewardExchangeRecords, err error)
FindHappyOrchardRewardExchangeRecordsByUid(uid int) (mm *[]models.HappyOrchardRewardExchangeRecords, err error)
GetHappyOrchardRewardExchangeRecordsByRecordId(id int) (m *models.HappyOrchardRewardExchangeRecords, err error)
GetHappyOrchardRewardExchangeRecordsByUidWithState(uid, state int) (m *models.HappyOrchardRewardExchangeRecords, err error)
GetHappyOrchardRewardExchangeRecordsByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardRewardExchangeRecords, err error)
}

+ 8
- 0
src/dao/happy_orchard_reward_with_seed_dao.go View File

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

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

type HappyOrchardRewardWithSeedDao interface {
FindHappyOrchardRewardWithSeedBySeedId(seedId []int) (m *[]models.HappyOrchardRewardWithSeed, err error)
FindHappyOrchardRewardWithSeedBySeedIdAndId(rewardId, seedId int) (m *models.HappyOrchardRewardWithSeed, err error)
}

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

@@ -4,4 +4,5 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"

type HappyOrchardSeedDao interface {
GetHappyOrchardSeed(id int) (m *models.HappyOrchardSeed, err error)
FindHappyOrchardSeedAll(start, limit int) (mm *[]models.HappyOrchardSeed, err error)
}

+ 14
- 0
src/dao/happy_orchard_seed_record_dao.go View File

@@ -1,3 +1,4 @@
<<<<<<< HEAD
package dao

import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
@@ -5,4 +6,17 @@ import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
type HappyOrchardUserSeedRecordDao interface {
GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error)
FindHappyOrchardUserSeedRecordsByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error)
=======
package dao

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

type HappyOrchardUserSeedRecordDao interface {
GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error)
FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error)
GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error)
GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error)
>>>>>>> f2a8ff9c85ab744b6d70d0d47df094f2a870d34a
}

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

@@ -6,4 +6,5 @@ import (

type HappyOrchardUserWatersDao interface {
GetHappyOrchardUserWaters(uid int) (m *models.HappyOrchardUserWaters, err error)
GetHappyOrchardUserWatersSess(uid int) (m *models.HappyOrchardUserWaters, err error)
}

+ 6
- 6
src/implement/happy_orchard_basic_setting_db.go View File

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
@@ -11,9 +11,13 @@ type HappyOrchardBasicSettingDb struct {
Db *xorm.Engine
}

func NewHappyOrchardBasicSettingDb(engine *xorm.Engine) dao.HappyOrchardBasicSettingDao {
return &HappyOrchardBasicSettingDb{Db: engine}
}

func (h HappyOrchardBasicSettingDb) GetHappyOrchardBasicSetting() (m *models.HappyOrchardBasicSetting, err error) {
m = new(models.HappyOrchardBasicSetting)
has, err := h.Db.Where("id > 0").Get(m)
has, err := h.Db.Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
@@ -22,7 +26,3 @@ func (h HappyOrchardBasicSettingDb) GetHappyOrchardBasicSetting() (m *models.Hap
}
return m, nil
}

func NewHappyOrchardBasicSettingDb(engine *xorm.Engine) dao.HappyOrchardBasicSettingDao {
return &HappyOrchardBasicSettingDb{Db: engine}
}

+ 14
- 0
src/implement/happy_orchard_reward_db.go View File

@@ -26,3 +26,17 @@ func (h HappyOrchardRewardDb) GetHappyOrchardReward(id int) (m *models.HappyOrch
}
return m, nil
}
func (h HappyOrchardRewardDb) FindHappyOrchardRewardById(id []int) (mm *[]models.HappyOrchardReward, err error) {
var m []models.HappyOrchardReward
if err := h.Db.In("id", id).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}
func (h HappyOrchardRewardDb) FindHappyOrchardRewardAll(rewardIds []int, start, limit int) (mm *[]models.HappyOrchardReward, err error) {
var m []models.HappyOrchardReward
if err := h.Db.Where("nums>0").In("id", rewardIds).OrderBy("sort desc,id desc").Limit(limit, start).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

+ 33
- 0
src/implement/happy_orchard_reward_exchange_records_db.go View File

@@ -36,3 +36,36 @@ func (h HappyOrchardRewardExchangeRecordsDb) FindHappyOrchardRewardExchangeRecor
}
return &m, nil
}
func (h HappyOrchardRewardExchangeRecordsDb) GetHappyOrchardRewardExchangeRecordsByUidWithState(uid, state int) (m *models.HappyOrchardRewardExchangeRecords, err error) {
m = new(models.HappyOrchardRewardExchangeRecords)
has, err := h.Db.Where("uid =? and state=?", uid, state).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (h HappyOrchardRewardExchangeRecordsDb) GetHappyOrchardRewardExchangeRecordsByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardRewardExchangeRecords, err error) {
m = new(models.HappyOrchardRewardExchangeRecords)
has, err := h.Db.Where("uid =? and state=? and id=?", uid, state, id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (h HappyOrchardRewardExchangeRecordsDb) GetHappyOrchardRewardExchangeRecordsByRecordId(id int) (m *models.HappyOrchardRewardExchangeRecords, err error) {
m = new(models.HappyOrchardRewardExchangeRecords)
has, err := h.Db.Where("record_id=?", id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 35
- 0
src/implement/happy_orchard_reward_with_seed_db.go View File

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

func NewHappyOrchardRewardWithSeedDb(engine *xorm.Engine) dao.HappyOrchardRewardWithSeedDao {
return &happyOrchardRewardWithSeedDb{Db: engine}
}

func (h happyOrchardRewardWithSeedDb) FindHappyOrchardRewardWithSeedBySeedId(seedId []int) (mm *[]models.HappyOrchardRewardWithSeed, err error) {
var m []models.HappyOrchardRewardWithSeed
if err := h.Db.In("seed_id", seedId).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}
func (h happyOrchardRewardWithSeedDb) FindHappyOrchardRewardWithSeedBySeedIdAndId(rewardId, seedId int) (m *models.HappyOrchardRewardWithSeed, err error) {
m = new(models.HappyOrchardRewardWithSeed)
has, err := h.Db.Where("reward_id=? and seed_id=?", rewardId, seedId).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 7
- 0
src/implement/happy_orchard_seed_db.go View File

@@ -26,3 +26,10 @@ func (h HappyOrchardSeedDb) GetHappyOrchardSeed(id int) (m *models.HappyOrchardS
}
return m, nil
}
func (h HappyOrchardSeedDb) FindHappyOrchardSeedAll(start, limit int) (mm *[]models.HappyOrchardSeed, err error) {
var m []models.HappyOrchardSeed
if err := h.Db.OrderBy("sort desc,id desc").Limit(limit, start).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

+ 43
- 0
src/implement/happy_orchard_sign_day_db.go View File

@@ -0,0 +1,43 @@
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 happyOrchardSignDayDb struct {
Db *xorm.Engine
Sess *xorm.Session
}

func NewHappyOrchardSignDayDb(engine *xorm.Engine) dao.HappyOrchardSignDayDao {
return &happyOrchardSignDayDb{Db: engine}
}
func NewHappyOrchardSignDaySess(sess *xorm.Session) dao.HappyOrchardSignDayDao {
return &happyOrchardSignDayDb{Sess: sess}
}
func (h happyOrchardSignDayDb) GetHappyOrchardSignDaySess(uid int) (m *models.HappyOrchardSignDay, err error) {
m = new(models.HappyOrchardSignDay)
has, err := h.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 happyOrchardSignDayDb) GetHappyOrchardSignDay(uid int) (m *models.HappyOrchardSignDay, err error) {
m = new(models.HappyOrchardSignDay)
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
}

+ 60
- 0
src/implement/happy_orchard_user_seed_record_db.go View File

@@ -0,0 +1,60 @@
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"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx"
"xorm.io/xorm"
)

type happyOrchardUserSeedRecordDb struct {
Db *xorm.Engine
}

func NewHappyOrchardUserSeedRecordDb(engine *xorm.Engine) dao.HappyOrchardUserSeedRecordDao {
return &happyOrchardUserSeedRecordDb{Db: engine}
}

func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecord(id int) (m *models.HappyOrchardUserSeedRecord, err error) {
//TODO implement me
m = new(models.HappyOrchardUserSeedRecord)
has, err := h.Db.Where("id =?", id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func (h happyOrchardUserSeedRecordDb) FindHappyOrchardUserSeedRecordByUid(uid int) (mm *[]models.HappyOrchardUserSeedRecord, err error) {
//TODO implement me
var m []models.HappyOrchardUserSeedRecord
if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}
func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithState(uid, state int) (m *models.HappyOrchardUserSeedRecord, err error) {
m = new(models.HappyOrchardUserSeedRecord)
has, err := h.Db.Where("uid =? and state=?", uid, state).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}
func (h happyOrchardUserSeedRecordDb) GetHappyOrchardUserSeedRecordByUidWithStateAndId(uid, id, state int) (m *models.HappyOrchardUserSeedRecord, err error) {
m = new(models.HappyOrchardUserSeedRecord)
has, err := h.Db.Where("uid =? and state=? and id=?", uid, state, id).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 17
- 1
src/implement/happy_orchard_user_waters_db.go View File

@@ -8,13 +8,18 @@ import (
)

type happyOrchardUserWatersDb struct {
Db *xorm.Engine
Db *xorm.Engine
Sess *xorm.Session
}

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)
@@ -26,3 +31,14 @@ func (h happyOrchardUserWatersDb) GetHappyOrchardUserWaters(uid int) (m *models.
}
return m, nil
}
func (h happyOrchardUserWatersDb) GetHappyOrchardUserWatersSess(uid int) (m *models.HappyOrchardUserWaters, err error) {
m = new(models.HappyOrchardUserWaters)
has, err := h.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
}

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

@@ -10,6 +10,7 @@ type HappyOrchardBasicSetting struct {
AdRotationData int `json:"ad_rotation_data" xorm:"not null default 1 comment('广告轮播数据(1:仅读取真实数据 2:仅读取虚拟数据 3:两者都读取)') TINYINT(1)"`
IsOpenSevenDaysSign int `json:"is_open_seven_days_sign" xorm:"not null default 1 comment('是否开启7日签到(1:开启 0:关闭)') TINYINT(1)"`
SevenDaysSignRewardData string `json:"seven_days_sign_reward_data" xorm:"not null comment('7日签到奖励数据') TEXT"`
VideoSevenDaysSignRewardData string `json:"video_seven_days_sign_reward_data" xorm:"not null comment('观看视频后的7日签到奖励数据') TEXT"`
IsOpenTimerSign int `json:"is_open_timer_sign" xorm:"not null default 1 comment('是否开启定时签到(1:开启 0:关闭)') TINYINT(1)"`
TimerSignRewardData string `json:"timer_sign_reward_data" xorm:"not null comment('定时签到奖励数据') TEXT"`
IsOpenPlaceOrderReward int `json:"is_open_place_order_reward" xorm:"not null default 1 comment('是否下单获得奖励(1:开启 0:关闭)') TINYINT(1)"`


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

@@ -10,6 +10,7 @@ type HappyOrchardRewardExchangeRecords struct {
SeedName string `json:"seed_name" xorm:"not null default '' comment('种子名称') VARCHAR(255)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('所需水滴数') INT(11)"`
State int `json:"state" xorm:"not null default 0 comment('兑换状态(1:未发放 2:已发放)') TINYINT(1)"`
RecordId int `json:"record_id" xorm:"default 0 INT(11)"`
LogisticCompany string `json:"logistic_company" xorm:"not null default '' comment('物流公司') VARCHAR(255)"`
LogisticCompanyCode string `json:"logistic_company_code" xorm:"not null default '' comment('物流公司代号') CHAR(50)"`
LogisticNum string `json:"logistic_num" xorm:"default '' comment('物流单号') VARCHAR(255)"`


+ 10
- 0
src/models/happy_orchard_sign_day.go View File

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

type HappyOrchardSignDay struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int `json:"uid" xorm:"default 0 INT(11)"`
ContinuityDay int `json:"continuity_day" xorm:"default 0 comment('连续签到天数') INT(11)"`
LastContinuityDay int `json:"last_continuity_day" xorm:"comment('上一次连续签到天数') INT(11)"`
SignTime int `json:"sign_time" xorm:"default 0 comment('20240409') INT(11)"`
LastSignTime int `json:"last_sign_time" xorm:"default 0 comment('20240409') INT(11)"`
}

+ 15
- 0
src/models/happy_orchard_user_seed_record.go View File

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

import (
"time"
)

type HappyOrchardUserSeedRecord struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int `json:"uid" xorm:"INT(11)"`
SeedId int `json:"seed_id" xorm:"not null default 0 INT(11)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('当前获得水滴数') INT(11)"`
State int `json:"state" xorm:"not null default 1 comment('状态(1:种植中 2:待领取 3:已领取)') INT(11)"`
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
}

Loading…
Cancel
Save