@@ -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) | |||||
} |
@@ -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) | |||||
} |
@@ -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 | |||||
} |
@@ -7,15 +7,15 @@ import ( | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
type happyOrchardRewardExchangeRecordsDao struct { | |||||
type happyOrchardRewardExchangeRecordsDb struct { | |||||
Db *xorm.Engine | 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 | //TODO implement me | ||||
m = new(models.HappyOrchardRewardExchangeRecords) | m = new(models.HappyOrchardRewardExchangeRecords) | ||||
has, err := h.Db.Where("id =?", id).Get(m) | has, err := h.Db.Where("id =?", id).Get(m) | ||||
@@ -28,7 +28,7 @@ func (h happyOrchardRewardExchangeRecordsDao) GetHappyOrchardRewardExchangeRecor | |||||
return m, nil | 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 | //TODO implement me | ||||
var m []models.HappyOrchardRewardExchangeRecords | var m []models.HappyOrchardRewardExchangeRecords | ||||
if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil { | if err := h.Db.Where("uid =?", uid).Desc("id").Find(&m); err != nil { |
@@ -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 | |||||
} |
@@ -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"` | |||||
} |
@@ -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)"` | |||||
} |
@@ -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"` | |||||
} |
@@ -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"` | |||||
} |
@@ -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"` | |||||
} |
@@ -8,7 +8,7 @@ import ( | |||||
func TestImplementServer_GetHappyOrchardRewardExchangeRecords(t *testing.T) { | func TestImplementServer_GetHappyOrchardRewardExchangeRecords(t *testing.T) { | ||||
Init() | Init() | ||||
dao := implement.NewHappyOrchardRewardExchangeRecordsDao(Db) | |||||
dao := implement.NewHappyOrchardRewardExchangeRecordsDb(Db) | |||||
record, err := dao.GetHappyOrchardRewardExchangeRecords(1) | record, err := dao.GetHappyOrchardRewardExchangeRecords(1) | ||||
if err != nil { | if err != nil { | ||||
fmt.Println("error:", err.Error()) | fmt.Println("error:", err.Error()) | ||||