shenjiachi преди 1 седмица
родител
ревизия
aad2c7bb27
променени са 4 файла, в които са добавени 8 реда и са изтрити 32 реда
  1. +3
    -9
      src/implement/public_platoon_free_punish_with_user_implement.go
  2. +1
    -7
      src/implement/user_virtual_amount_implement.go
  3. +3
    -9
      src/implement/user_virtual_coin_flow_implement.go
  4. +1
    -7
      src/implement/virtual_coin_implement.go

+ 3
- 9
src/implement/public_platoon_free_punish_with_user_implement.go Целия файл

@@ -55,20 +55,14 @@ func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserUpdate

func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserCountAndGetPageByParams(page int, limit int, params map[string]interface{}) ([]model.PublicPlatoonFreePunishWithUser, int64, error) {

var publicPlatoonFreePunishWithUser model.PublicPlatoonFreePunishWithUser
total, err := p.Db.Where("").Count(&publicPlatoonFreePunishWithUser)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err)
}

var m []model.PublicPlatoonFreePunishWithUser
session := p.Db
var total int64
var err1 error
if params != nil {
query := fmt.Sprintf("%s = ?", params["key"])
err1 = session.Where(query, params["value"]).Limit(limit, (page-1)*limit).Find(&m)
total, err1 = p.Db.Where(query, params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m)
} else {
err1 = session.Where("1=1").Limit(limit, (page-1)*limit).Find(&m)
total, err1 = p.Db.Where("1=1").Limit(limit, (page-1)*limit).FindAndCount(&m)
}
if err1 != nil {
return nil, 0, zhios_order_relate_logx.Error(err1)


+ 1
- 7
src/implement/user_virtual_amount_implement.go Целия файл

@@ -37,13 +37,7 @@ func (u UserVirtualAmountDb) GetUserVirtualWalletBySession(uid int64, coinId int

func (u UserVirtualAmountDb) UserVirtualAmountFindAndCountByCoinKind(coinID int, page, pageSize int) ([]model.UserVirtualAmount, int64, error) {
var userVirtualWallets []model.UserVirtualAmount
session := u.Db.Where("coin_id = ?", coinID)
total, err1 := session.Count(&userVirtualWallets)
if err1 != nil {
return nil, 0, zhios_order_relate_logx.Error(err1.Error())
}

err := session.Limit(pageSize, (page-1)*pageSize).Desc("amount").Find(&userVirtualWallets)
total, err := u.Db.Where("coin_id = ?", coinID).Limit(pageSize, (page-1)*pageSize).Desc("amount").FindAndCount(&userVirtualWallets)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err.Error())
}


+ 3
- 9
src/implement/user_virtual_coin_flow_implement.go Целия файл

@@ -3,7 +3,6 @@
import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"xorm.io/xorm"
)

@@ -30,14 +29,9 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSi
session = session.And("direction = ?", direction)
}

total, err1 := session.Count(&m)
if err1 != nil {
return nil, 0, zhios_order_relate_logx.Error(err1.Error())
}

err2 := session.Limit(pageSize, (page-1)*pageSize).Desc("create_at").Find(m)
if err2 != nil {
return nil, 0, err2
total, err := session.Limit(pageSize, (page-1)*pageSize).Desc("create_at").FindAndCount(&m)
if err != nil {
return nil, 0, err
}

return m, total, nil


+ 1
- 7
src/implement/virtual_coin_implement.go Целия файл

@@ -17,13 +17,7 @@ type VirtualCoinDb struct {

func (v VirtualCoinDb) VirtualCoinFindAllAndCount(pageSize, page int) (kindList []model.VirtualCoin, total int64, err error) {
var m []model.VirtualCoin
session := v.Db.Where("is_use = ?", 1)
total, err = session.Count(&m)
if err != nil {
return nil, 0, err
}

err = session.Asc("id").Limit(pageSize, (page-1)*pageSize).Find(&m)
total, err = v.Db.Where("is_use = ?", 1).Asc("id").Limit(pageSize, (page-1)*pageSize).FindAndCount(&m)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err)
}


Зареждане…
Отказ
Запис