Przeglądaj źródła

update

tags/v0.0.2
dengbiao 1 tydzień temu
rodzic
commit
6ef2354f39
7 zmienionych plików z 83 dodań i 8 usunięć
  1. +3
    -1
      src/dao/user_wallet_dao.go
  2. +10
    -0
      src/dao/user_wallet_flow_dao.go
  3. +23
    -0
      src/implement/user_wallet_flow_implement.go
  4. +20
    -0
      src/implement/user_wallet_implement.go
  5. +1
    -1
      src/model/egg_energy_available_energy_flow.go
  6. +8
    -6
      src/model/egg_energy_user_watch_records.go
  7. +18
    -0
      src/model/user_wallet_flow.go

+ 3
- 1
src/dao/user_wallet_dao.go Wyświetl plik

@@ -1,5 +1,7 @@
package dao

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

type UserWalletDao interface {
//TODO:: You can add specific method definitions here
GetUserVirtualWallet(uid int64) (*model.UserWallet, error)
}

+ 10
- 0
src/dao/user_wallet_flow_dao.go Wyświetl plik

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

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

type UserWalletFlowDao interface {
UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error)
}

+ 23
- 0
src/implement/user_wallet_flow_implement.go Wyświetl plik

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

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

func NewUserWalletFlowDb(engine *xorm.Engine) dao.UserWalletFlowDao {
return &UserWalletFlowDb{Db: engine}
}

type UserWalletFlowDb struct {
Db *xorm.Engine
}

func (u UserWalletFlowDb) UserWalletFlowInsertBySession(session *xorm.Session, userWalletFlow *model.UserWalletFlow) (int64, error) {
_, err := session.InsertOne(userWalletFlow)
if err != nil {
return 0, err
}
return userWalletFlow.Id, nil
}

+ 20
- 0
src/implement/user_wallet_implement.go Wyświetl plik

@@ -2,6 +2,7 @@

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

@@ -12,3 +13,22 @@ func NewUserWalletDb(engine *xorm.Engine) dao.UserWalletDao {
type UserWalletDb struct {
Db *xorm.Engine
}

func (u UserWalletDb) GetUserVirtualWallet(uid int64) (*model.UserWallet, error) {
var userWallet model.UserWallet
get, err := u.Db.Where("uid = ?", uid).Get(&userWallet)
if err != nil {
return nil, err
}
if get {
return &userWallet, nil
} else {
userWallet.Amount = "0"
userWallet.Uid = uid
one, err1 := u.Db.InsertOne(&userWallet)
if err1 != nil || one == 0 {
return nil, err1
}
return &userWallet, nil
}
}

+ 1
- 1
src/model/egg_energy_available_energy_flow.go Wyświetl plik

@@ -2,7 +2,7 @@ package model

type EggEnergyAvailableEnergyFlow struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Kind int `json:"kind" xorm:"not null default 1 comment('种类(1:个人蛋蛋积分兑换 2:团队蛋蛋积分兑换 3:余额兑换蛋蛋能量 4:蛋蛋能量兑换余额 5:星级分红 6:社区分红 7:平台盈利)') TINYINT(1)"`
Kind int `json:"kind" xorm:"not null default 1 comment('种类(1:个人蛋蛋积分兑换 2:团队蛋蛋积分兑换 3:余额兑换蛋蛋能量 4:蛋蛋能量兑换余额 5:星级分红 6:社区分红 7:平台盈利 8:市商数量自动兑换市商资金 9:市商资金自动兑换市商数量 10:资金注入)') TINYINT(1)"`
Title string `json:"title" xorm:"not null default '' comment('标题') VARCHAR(255)"`
BeforePrice string `json:"before_price" xorm:"not null default 0.0000000000 comment('变更前-价格') DECIMAL(28,10)"`
AfterPrice string `json:"after_price" xorm:"not null default 0.0000000000 comment('变更后-价格') DECIMAL(28,10)"`


+ 8
- 6
src/model/egg_energy_user_watch_records.go Wyświetl plik

@@ -1,10 +1,12 @@
package model

import "time"

type EggEnergyUserWatchRecords struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') index BIGINT(20)"`
NextWatchAdDate string `json:"next_watch_ad_date" xorm:"not null default 'CURRENT_TIMESTAMP' comment('下一轮观看视屏时间') DATETIME"`
ResidueWatchAdNum int `json:"residue_watch_ad_num" xorm:"not null default 0 comment('剩余观看视屏数') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') index BIGINT(20)"`
NextWatchAdDate time.Time `json:"next_watch_ad_date" xorm:"not null default 'CURRENT_TIMESTAMP' comment('下一轮观看视屏时间') DATETIME"`
ResidueWatchAdNum int `json:"residue_watch_ad_num" xorm:"not null default 0 comment('剩余观看视屏数') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

+ 18
- 0
src/model/user_wallet_flow.go Wyświetl plik

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

type UserWalletFlow struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户id') index BIGINT(20)"`
Direction int `json:"direction" xorm:"not null default 0 comment('方向:1收入 2支出') index TINYINT(1)"`
Amount string `json:"amount" xorm:"not null default 0.00000000 comment('变动金额') DECIMAL(20,8)"`
BeforeAmount string `json:"before_amount" xorm:"not null default 0.00000000 comment('变动前金额') DECIMAL(20,8)"`
AfterAmount string `json:"after_amount" xorm:"not null default 0.00000000 comment('变动后金额') DECIMAL(20,8)"`
SysFee string `json:"sys_fee" xorm:"not null default 0.00000000 comment('手续费') DECIMAL(20,8)"`
OrdId string `json:"ord_id" xorm:"not null default '' comment('对应订单编号') VARCHAR(50)"`
Title string `json:"title" xorm:"not null default '' comment('标题') VARCHAR(50)"`
Kind int `json:"kind" xorm:"not null default 0 comment('1:管理员操作增加余额 2:管理员操作扣除余额 3:蛋蛋能量兑换余额 4:余额兑换蛋蛋能量') TINYINT(3)"`
State int `json:"state" xorm:"not null default 1 comment('1未到账,2已到账') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') TIMESTAMP"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"`
}

Ładowanie…
Anuluj
Zapisz