Ver a proveniência

add reverse:for v1.4.6 共富流水修改

tags/v1.4.6
huangjiajun há 2 anos
ascendente
cometimento
45d816c8eb
2 ficheiros alterados com 65 adições e 1 eliminações
  1. +20
    -0
      db/model/user_public_platoon_income_records.go
  2. +45
    -1
      rule/public_platoon_settle.go

+ 20
- 0
db/model/user_public_platoon_income_records.go Ver ficheiro

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

import (
"time"
)

type UserPublicPlatoonIncomeRecords struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null comment('用户id') index INT(11)"`
CoinId int `json:"coin_id" xorm:"not null default 0 comment('虚拟币id(0为金额)') INT(11)"`
Amount string `json:"amount" xorm:"not null default '' comment('结算金额') VARCHAR(50)"`
Title string `json:"title" xorm:"comment('标题') VARCHAR(255)"`
Date string `json:"date" xorm:"not null default '' comment('结算日期(0000-00)') VARCHAR(50)"`
Kind int `json:"kind" xorm:"not null default 1 comment('结算种类(1:转入用户余额 2:清零)') TINYINT(1)"`
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
Oid string `json:"oid" xorm:"comment('订单号') VARCHAR(100)"`
Type int `json:"type" xorm:"not null default 0 comment('0收入 1支出') INT(11)"`
BeforeAmount string `json:"before_amount" xorm:"comment('变更前金额') VARCHAR(100)"`
}

+ 45
- 1
rule/public_platoon_settle.go Ver ficheiro

@@ -34,7 +34,7 @@ func PublicPlatoonSettle(session *xorm.Session, ItemTitle, ordId string, uid, co
return false
}
}
finUserFlow := model.UserPublicPlatoonSettlementRecords{
finUserFlow := model.UserPublicPlatoonIncomeRecords{
Type: 0,
Uid: uid,
Amount: zhios_order_relate_utils.AnyToString(amount),
@@ -53,3 +53,47 @@ func PublicPlatoonSettle(session *xorm.Session, ItemTitle, ordId string, uid, co
}
return true
}
func PublicPlatoonAddRecord(eg *xorm.Engine, ItemTitle, ordId string, uid, coinId, kind, types int, amount float64, beforeAmount string) bool {
now := time.Now()

finUserFlow := model.UserPublicPlatoonIncomeRecords{
Type: types,
Uid: uid,
Amount: zhios_order_relate_utils.AnyToString(amount),
CreateAt: now,
UpdateAt: now,
Date: now.Format("2006-01"),
Kind: kind,
CoinId: coinId,
Title: ItemTitle,
BeforeAmount: beforeAmount,
Oid: ordId,
}
_, err := eg.Insert(&finUserFlow)
if err != nil {
return false
}
return true
}
func PublicPlatoonAddRecordWithSession(session *xorm.Session, ItemTitle, ordId string, uid, coinId, kind, types int, amount float64, beforeAmount string) bool {
now := time.Now()

finUserFlow := model.UserPublicPlatoonIncomeRecords{
Type: types,
Uid: uid,
Amount: zhios_order_relate_utils.AnyToString(amount),
CreateAt: now,
UpdateAt: now,
Date: now.Format("2006-01"),
Kind: kind,
CoinId: coinId,
Title: ItemTitle,
BeforeAmount: beforeAmount,
Oid: ordId,
}
_, err := session.Insert(&finUserFlow)
if err != nil {
return false
}
return true
}

Carregando…
Cancelar
Guardar