Browse Source

update

master
dengbiao 5 months ago
parent
commit
96c37b747c
11 changed files with 136 additions and 6 deletions
  1. +9
    -0
      src/dao/happy_happy_orchard_reward_dao.go
  2. +9
    -0
      src/dao/happy_happy_orchard_seed_dao.go
  3. +28
    -0
      src/implement/happy_orchard_reward_db.go
  4. +5
    -5
      src/implement/happy_orchard_reward_exchange_records_db.go
  5. +28
    -0
      src/implement/happy_orchard_seed_db.go
  6. +15
    -0
      src/models/happy_orchard_reward.go
  7. +7
    -0
      src/models/happy_orchard_reward_with_seed.go
  8. +12
    -0
      src/models/happy_orchard_seed.go
  9. +9
    -0
      src/models/happy_orchard_user_waters.go
  10. +13
    -0
      src/models/happy_orchard_user_waters_log.go
  11. +1
    -1
      test/repositories_test.go

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

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

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

type HappyOrchardRewardDao interface {
GetHappyOrchardRewardDao(id int) (m *models.HappyOrchardReward, err error)
}

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

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

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

type HappyOrchardSeedDao interface {
GetHappyOrchardSeedDao(id int) (m *models.HappyOrchardSeed, err error)
}

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

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

func NewHappyOrchardRewardDb(engine *xorm.Engine) dao.HappyOrchardRewardDao {
return &happyOrchardRewardDb{Db: engine}
}

func (h happyOrchardRewardDb) GetHappyOrchardRewardDao(id int) (m *models.HappyOrchardReward, err error) {
m = new(models.HappyOrchardReward)
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
}

src/implement/happy_orchard_reward_exchange_records_repositories.go → src/implement/happy_orchard_reward_exchange_records_db.go View File

@@ -7,15 +7,15 @@ import (
"xorm.io/xorm"
)

type happyOrchardRewardExchangeRecordsDao struct {
type happyOrchardRewardExchangeRecordsDb struct {
Db *xorm.Engine
}

func NewHappyOrchardRewardExchangeRecordsDao(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
return &happyOrchardRewardExchangeRecordsDao{Db: engine}
func NewHappyOrchardRewardExchangeRecordsDb(engine *xorm.Engine) dao.HappyOrchardRewardExchangeRecordsDao {
return &happyOrchardRewardExchangeRecordsDb{Db: engine}
}

func (h happyOrchardRewardExchangeRecordsDao) GetHappyOrchardRewardExchangeRecords(id int) (m *models.HappyOrchardRewardExchangeRecords, err error) {
func (h happyOrchardRewardExchangeRecordsDb) GetHappyOrchardRewardExchangeRecords(id int) (m *models.HappyOrchardRewardExchangeRecords, err error) {
//TODO implement me
m = new(models.HappyOrchardRewardExchangeRecords)
has, err := h.Db.Where("id =?", id).Get(m)
@@ -28,7 +28,7 @@ func (h happyOrchardRewardExchangeRecordsDao) GetHappyOrchardRewardExchangeRecor
return m, nil
}

func (h happyOrchardRewardExchangeRecordsDao) FindHappyOrchardRewardExchangeRecordsByUid(uid int) (mm *[]models.HappyOrchardRewardExchangeRecords, err error) {
func (h happyOrchardRewardExchangeRecordsDb) FindHappyOrchardRewardExchangeRecordsByUid(uid int) (mm *[]models.HappyOrchardRewardExchangeRecords, err error) {
//TODO implement me
var m []models.HappyOrchardRewardExchangeRecords
if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil {

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

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

func NewHappyOrchardSeedDb(engine *xorm.Engine) dao.HappyOrchardSeedDao {
return &happyOrchardSeedDb{Db: engine}
}

func (h happyOrchardSeedDb) GetHappyOrchardSeedDao(id int) (m *models.HappyOrchardSeed, err error) {
m = new(models.HappyOrchardSeed)
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
}

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

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

type HappyOrchardReward struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
Kind int `json:"kind" xorm:"not null default 1 comment('奖品类型(1:赠送商品 2:虚拟商品)') TINYINT(1)"`
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"`
Nums int `json:"nums" xorm:"not null default 0 comment('奖品总数') INT(11)"`
ImgUrl string `json:"img_url" xorm:"not null default '' comment('图片地址') VARCHAR(255)"`
Value int `json:"value" xorm:"not null default 0 comment('具体值(kind=2时代表虚拟币值)') INT(11)"`
CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id(kind=2时代表虚拟币id)') INT(11)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
Sort int `json:"sort" xorm:"not null default 0 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"`
}

+ 7
- 0
src/models/happy_orchard_reward_with_seed.go View File

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

type HappyOrchardRewardWithSeed struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
RewardId int `json:"reward_id" xorm:"not null default 0 comment('奖品id') INT(11)"`
SeedId int `json:"seed_id" xorm:"not null default 0 comment('种子id') INT(11)"`
}

+ 12
- 0
src/models/happy_orchard_seed.go View File

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

type HappyOrchardSeed struct {
Id int `json:"id" xorm:"not null pk autoincr comment('自增id') INT(11)"`
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('所需水滴数') INT(11)"`
SeedImgUrl string `json:"seed_img_url" xorm:"not null default '' comment('种子图片地址') VARCHAR(255)"`
SeedMatureImgUrl string `json:"seed_mature_img_url" xorm:"not null default '' comment('种子成熟后图片地址') VARCHAR(255)"`
Sort int `json:"sort" xorm:"not null default 0 comment('排序') 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"`
}

+ 9
- 0
src/models/happy_orchard_user_waters.go View File

@@ -0,0 +1,9 @@
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)"`
WaterNums int `json:"water_nums" xorm:"not null default 0 comment('水滴数') 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"`
}

+ 13
- 0
src/models/happy_orchard_user_waters_log.go View File

@@ -0,0 +1,13 @@
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)"`
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)"`
BeforeWaterNums int `json:"before_water_nums" xorm:"not null default 0 comment('之前水滴数') INT(11)"`
AfterWaterNums int `json:"after_water_nums" xorm:"not null default 0 comment('之后水滴数') 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
test/repositories_test.go View File

@@ -8,7 +8,7 @@ import (

func TestImplementServer_GetHappyOrchardRewardExchangeRecords(t *testing.T) {
Init()
dao := implement.NewHappyOrchardRewardExchangeRecordsDao(Db)
dao := implement.NewHappyOrchardRewardExchangeRecordsDb(Db)
record, err := dao.GetHappyOrchardRewardExchangeRecords(1)
if err != nil {
fmt.Println("error:", err.Error())


Loading…
Cancel
Save