瀏覽代碼

update

master
shenjiachi 2 天之前
父節點
當前提交
9e05dce2ed
共有 4 個檔案被更改,包括 16 行新增2 行删除
  1. +1
    -1
      src/dao/user_virtual_coin_flow_dao.go
  2. +1
    -0
      src/dao/virtual_coin_dao.go
  3. +4
    -1
      src/implement/user_virtual_coin_flow_implement.go
  4. +10
    -0
      src/implement/virtual_coin_implement.go

+ 1
- 1
src/dao/user_virtual_coin_flow_dao.go 查看文件

@@ -7,5 +7,5 @@ import (

type UserVirtualCoinFlowDao interface {
UserVirtualCoinFlowInsertBySession(session *xorm.Session, UserVirtualCoinFlow *model.UserVirtualCoinFlow) (int64, error)
UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool) ([]model.UserVirtualCoinFlow, int64, error)
UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool, transferType int) ([]model.UserVirtualCoinFlow, int64, error)
}

+ 1
- 0
src/dao/virtual_coin_dao.go 查看文件

@@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
type VirtualCoinDao interface {
//TODO:: You can add specific method definitions here
VirtualCoinFindAll() ([]model.VirtualCoin, error)
VirtualCoinGetOneByParams(params map[string]interface{}) (*model.VirtualCoin, error)
}

+ 4
- 1
src/implement/user_virtual_coin_flow_implement.go 查看文件

@@ -22,7 +22,7 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowInsertBySession(session *xorm.
return UserVirtualCoinFlow.Id, nil
}

func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool) ([]model.UserVirtualCoinFlow, int64, error) {
func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSize int, coinID int, uid int64, startAt string, endAt string, direction int, isAsc bool, transferType int) ([]model.UserVirtualCoinFlow, int64, error) {
var m []model.UserVirtualCoinFlow
session := u.Db.Where("uid = ?", uid).And("coin_id = ?", coinID)
if startAt != "" && endAt != "" {
@@ -31,6 +31,9 @@ func (u UserVirtualCoinFlowDb) UserVirtualCoinFlowFindByCoinAndUser(page, pageSi
if direction != 0 {
session = session.And("direction = ?", direction)
}
if transferType != 0{
session = session.And("type = ?", type)
}
session = session.Limit(pageSize, (page-1)*pageSize)
if isAsc {
session = session.Asc("create_at")


+ 10
- 0
src/implement/virtual_coin_implement.go 查看文件

@@ -4,6 +4,7 @@ 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"
"fmt"
"xorm.io/xorm"
)

@@ -23,3 +24,12 @@ func (v VirtualCoinDb) VirtualCoinFindAll() ([]model.VirtualCoin, error) {
}
return m, nil
}

func (v VirtualCoinDb) VirtualCoinGetOneByParams(params map[string]interface{}) (*model.VirtualCoin, error) {
var m model.VirtualCoin
var query = fmt.Sprintf("%s = ?", params["key"])
if has, err := v.Db.Where(query, params["value"]).Get(&m); err != nil || has == false {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

Loading…
取消
儲存