Ver a proveniência

add reverse:for v1.3.5 共富收益更新

tags/v1.3.5
huangjiajun há 2 anos
ascendente
cometimento
2bd4de0f51
3 ficheiros alterados com 70 adições e 13 eliminações
  1. +12
    -9
      db/model/user_public_platoon_settlement_records.go
  2. +54
    -0
      rule/public_platoon_settle.go
  3. +4
    -4
      rule/relate_commission.go

+ 12
- 9
db/model/user_public_platoon_settlement_records.go Ver ficheiro

@@ -5,13 +5,16 @@ import (
)

type UserPublicPlatoonSettlementRecords 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"`
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)"`
}

+ 54
- 0
rule/public_platoon_settle.go Ver ficheiro

@@ -0,0 +1,54 @@
package rule

import (
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model"
zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils"
"time"
"xorm.io/xorm"
)

func PublicPlatoonSettle(session *xorm.Session, ItemTitle, ordId string, uid, coinId int, amount float64) bool {
now := time.Now()
var data model.UserPublicPlatoonAmount
has, err := session.Where("uid=? and coin_id=?", uid, coinId).Get(&data)
if err != nil {
return false
}
beforeAmount := "0"
if has == false {
data = model.UserPublicPlatoonAmount{
Uid: uid,
CoinId: coinId,
Amount: zhios_order_relate_utils.AnyToString(amount),
}
_, err := session.Insert(&data)
if err != nil {
return false
}
} else {
beforeAmount = data.Amount
data.Amount = zhios_order_relate_utils.Float64ToStrByPrec(zhios_order_relate_utils.StrToFloat64(data.Amount)+amount, 6)
_, err := session.Where("id=?", data.Id).Cols("amount").Update(&data)
if err != nil {
return false
}
}
finUserFlow := model.UserPublicPlatoonSettlementRecords{
Type: 0,
Uid: uid,
Amount: zhios_order_relate_utils.AnyToString(amount),
CreateAt: now,
UpdateAt: now,
Date: now.Format("2006-01"),
Kind: 3,
CoinId: coinId,
Title: ItemTitle,
BeforeAmount: beforeAmount,
Oid: ordId,
}
_, err = session.Insert(&finUserFlow)
if err != nil {
return false
}
return true
}

+ 4
- 4
rule/relate_commission.go Ver ficheiro

@@ -45,7 +45,7 @@ func BatchGetCommissionByGoods(eg *xorm.Engine, dbName string, commissionParamLi
if param.GoodsId == "" {
return errors.New("商品ID缺失")
}
param.CommissionParam.Oid=param.GoodsId
param.CommissionParam.Oid = param.GoodsId
_, _, _, _, lvUser, err := svc.GetRewardCommission(eg, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType)
if err != nil {
return err
@@ -96,7 +96,7 @@ func BatchGetCommissionByOrder(engine *xorm.Engine, dbName string, CommissionPar
return errors.New("订单缺失")
}
param.CommissionParam.OldPrice = param.CommissionParam.GoodsPrice
param.CommissionParam.Oid=param.Oid
param.CommissionParam.Oid = param.Oid

profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(engine, &param.CommissionParam, isShare, param.Uid, param.Provider, dbName, isAllLevelReturn, map[string]string{}, virType)
if err != nil {
@@ -145,7 +145,7 @@ func SettleCommWithGoodsDetail(eg *xorm.Engine, dbName string, CommissionParam m
if virCfg != nil && virCfg.Val != "" {
virType = virCfg.Val
}
CommissionParam.CommissionParam.Oid=CommissionParam.GoodsId
CommissionParam.CommissionParam.Oid = CommissionParam.GoodsId

profit, pvdFee, sysFee, subsidyFee, lvUser, err := svc.GetRewardCommission(eg, &CommissionParam.CommissionParam, isShare, CommissionParam.Uid, CommissionParam.Provider, dbName, isAllLevelReturn, mapData, virType)
return profit, pvdFee, sysFee, subsidyFee, lvUser, err
@@ -168,7 +168,7 @@ func GetRewardCommission(eg *xorm.Engine, dbName, mode string, CommissionParam m
if CommissionParam.IsAllLevelReturn != 0 {
isAllLevelReturn = true
}
CommissionParam.CommissionParam.Oid=CommissionParam.GoodsId
CommissionParam.CommissionParam.Oid = CommissionParam.GoodsId
var lvUser = &comm_plan.LvUser{}
var mapsDta = map[string]string{"show_level": CommissionParam.ShowLevel}
if isAll {


Carregando…
Cancelar
Guardar