dengbiao 23 hours ago
parent
commit
7c47b67b46
4 changed files with 38 additions and 3 deletions
  1. +3
    -0
      src/dao/virtual_coin_dao.go
  2. +2
    -2
      src/implement/egg_energy_fund_data_implement.go
  3. +1
    -1
      src/implement/permission_group_implement.go
  4. +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 {


+ 1
- 1
src/implement/permission_group_implement.go View File

@@ -26,7 +26,7 @@ func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, erro

func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) {
var m []model.PermissionGroup
if err := p.Db.OrderBy("sort desc,id asc").Find(&m); err != nil {
if err := p.Db.OrderBy("id asc").Find(&m); err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, 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