Browse Source

update

master
shenjiachi 1 day ago
parent
commit
d1cf0a9dd1
3 changed files with 37 additions and 2 deletions
  1. +3
    -0
      src/dao/virtual_coin_dao.go
  2. +2
    -2
      src/implement/egg_energy_fund_data_implement.go
  3. +32
    -0
      src/implement/virtual_coin_implement.go

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

@@ -6,4 +6,7 @@ type VirtualCoinDao interface {
//TODO:: You can add specific method definitions here
VirtualCoinFindAll() ([]model.VirtualCoin, error)
VirtualCoinGetOneByParams(params map[string]interface{}) (*model.VirtualCoin, error)
VirtualCoinBatchAdd(virtualCoin []model.VirtualCoin) (int64, error)
VirtualCoinUpdate(virtualCoin *model.VirtualCoin, forceColumns ...string) (int64, error)
VirtualCoinDelete(id interface{}) (int64, error)
}

+ 2
- 2
src/implement/egg_energy_fund_data_implement.go View File

@@ -23,10 +23,10 @@ func (e EggEnergyFundDataDb) EggEnergyFundDataFindAndCount(page, limit, kind int
session = session.Where("kind = ?", kind)
}
if startAt != "" {
session = session.Where("start_at >= ?", startAt)
session = session.Where("create_at >= ?", startAt)
}
if endAt != "" {
session = session.Where("end_at <= ?", endAt)
session = session.Where("create_at <= ?", endAt)
}
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m)
if err != nil {


+ 32
- 0
src/implement/virtual_coin_implement.go View File

@@ -33,3 +33,35 @@ func (v VirtualCoinDb) VirtualCoinGetOneByParams(params map[string]interface{})
}
return &m, nil
}

func (v VirtualCoinDb) VirtualCoinBatchAdd(virtualCoin []model.VirtualCoin) (int64, error) {
affected, err := v.Db.Insert(virtualCoin)
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

func (v VirtualCoinDb) VirtualCoinUpdate(virtualCoin *model.VirtualCoin, forceColumns ...string) (int64, error) {
var (
affected int64
err error
)
if forceColumns != nil {
affected, err = v.Db.Where("id=?", virtualCoin.Id).MustCols(forceColumns...).Update(virtualCoin)
} else {
affected, err = v.Db.Where("id=?", virtualCoin.Id).Update(virtualCoin)
}
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

func (v VirtualCoinDb) VirtualCoinDelete(id interface{}) (int64, error) {
affected, err := v.Db.Where("id = ?", id).Delete(&model.VirtualCoin{})
if err != nil {
return 0, err
}
return affected, nil
}

Loading…
Cancel
Save