Преглед изворни кода

Merge remote-tracking branch 'origin/master'

master
huangjiajun пре 4 дана
родитељ
комит
13eb94de11
7 измењених фајлова са 90 додато и 0 уклоњено
  1. +9
    -0
      src/dao/egg_access_records_dao.go
  2. +1
    -0
      src/dao/egg_energy_available_energy_flow_dao.go
  3. +1
    -0
      src/dao/user_wallet_flow_dao.go
  4. +33
    -0
      src/implement/egg_access_records_implement.go
  5. +9
    -0
      src/implement/egg_energy_available_energy_flow_implement.go
  6. +29
    -0
      src/implement/user_wallet_flow_implement.go
  7. +8
    -0
      src/model/egg_access_records.go

+ 9
- 0
src/dao/egg_access_records_dao.go Прегледај датотеку

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggAccessRecordsDao interface {
//TODO:: You can add specific method definitions here
EggAccessRecordsExist(uid int64, date string, index string) (bool, error)
EggAccessRecordsInsert(m *model.EggAccessRecords) (int64, error)
}

+ 1
- 0
src/dao/egg_energy_available_energy_flow_dao.go Прегледај датотеку

@@ -8,4 +8,5 @@ import (
type EggEnergyAvailableEnergyFlowDao interface {
EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error)
EggEnergyAvailableEnergyFlowInsertBySession(session *xorm.Session, eggEnergyAvailableEnergyFlow *model.EggEnergyAvailableEnergyFlow) (int64, error)
EggEnergyAvailableEnergyFlowGetSumByKind(kind int) (float64, error)
}

+ 1
- 0
src/dao/user_wallet_flow_dao.go Прегледај датотеку

@@ -8,4 +8,5 @@ import (
type UserWalletFlowDao interface {
UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error)
UserWalletFlowFindByParams(params map[string]interface{}, page, limit int) (*[]model.UserWalletFlow, int64, error)
UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error)
}

+ 33
- 0
src/implement/egg_access_records_implement.go Прегледај датотеку

@@ -0,0 +1,33 @@
package implement

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"
)

func NewEggAccessRecordsDb(engine *xorm.Engine) dao.EggAccessRecordsDao {
return &EggAccessRecordsDb{Db: engine}
}

type EggAccessRecordsDb struct {
Db *xorm.Engine
}

func (e EggAccessRecordsDb) EggAccessRecordsExist(uid int64, date string, index string) (bool, error) {
var m model.EggAccessRecords
exist, err := e.Db.Where("uid = ?", uid).And("date = ?", date).And("page_index = ?", index).Exist(&m)
if err != nil {
return false, zhios_order_relate_logx.Error(err.Error())
}
return exist, nil
}

func (e EggAccessRecordsDb) EggAccessRecordsInsert(m *model.EggAccessRecords) (int64, error) {
_, err := e.Db.InsertOne(m)
if err != nil {
return 0, err
}
return m.Id, nil
}

+ 9
- 0
src/implement/egg_energy_available_energy_flow_implement.go Прегледај датотеку

@@ -41,3 +41,12 @@ func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount
}
return m, total, nil
}

func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowGetSumByKind(kind int) (float64, error) {
var m model.EggEnergyAvailableEnergyFlow
sum, err := e.Db.Where("kind = ?", kind).Sum(m, "amount")
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return sum, nil
}

+ 29
- 0
src/implement/user_wallet_flow_implement.go Прегледај датотеку

@@ -48,3 +48,32 @@ func (u UserWalletFlowDb) UserWalletFlowFindByParams(params map[string]interface
}
return &m, total, nil
}

func (u UserWalletFlowDb) UserWalletFlowFindByCoinAndUser(page, pageSize int, uid int64, startAt string, endAt string, direction int, isAsc bool, kind int, state int) ([]model.UserWalletFlow, int64, error) {
var m []model.UserWalletFlow
session := u.Db.Where("uid = ?", uid)
if startAt != "" && endAt != "" {
session = session.And("create_at >= ?", startAt).And("create_at <= ?", endAt)
}
if direction != 0 {
session = session.And("direction = ?", direction)
}
if kind != 0 {
session = session.And("kind = ?", kind)
}
if state != 0 {
session = session.And("state = ?", state)
}
session = session.Limit(pageSize, (page-1)*pageSize)
if isAsc {
session = session.Asc("create_at")
} else {
session = session.Desc("create_at")
}
total, err := session.FindAndCount(&m)
if err != nil {
return nil, 0, err
}

return m, total, nil
}

+ 8
- 0
src/model/egg_access_records.go Прегледај датотеку

@@ -0,0 +1,8 @@
package model

type EggAccessRecords struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null comment('用户ID') BIGINT(20)"`
PageIndex string `json:"page_index" xorm:"not null comment('页面标识') VARCHAR(50)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('访问日期') CHAR(50)"`
}

Loading…
Откажи
Сачувај