Parcourir la source

Merge remote-tracking branch 'origin/master'

three
DengBiao il y a 1 an
Parent
révision
6d8eb82705
3 fichiers modifiés avec 67 ajouts et 0 suppressions
  1. +30
    -0
      app/db/model/fin_user_flow.go
  2. +19
    -0
      consume/zhios_fast_return_order_pay.go
  3. +18
    -0
      consume/zhios_fast_return_order_refund.go

+ 30
- 0
app/db/model/fin_user_flow.go Voir le fichier

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

import (
"time"
)

type FinUserFlow struct {
Id int64 `json:"id" xorm:"pk autoincr comment('流水编号') BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
Type int `json:"type" xorm:"not null default 0 comment('0收入,1支出') TINYINT(1)"`
Amount string `json:"amount" xorm:"not null default 0.0000 comment('变动金额') DECIMAL(11,4)"`
BeforeAmount string `json:"before_amount" xorm:"not null default 0.0000 comment('变动前金额') DECIMAL(11,4)"`
AfterAmount string `json:"after_amount" xorm:"not null default 0.0000 comment('变动后金额') DECIMAL(11,4)"`
SysFee string `json:"sys_fee" xorm:"not null default 0.0000 comment('手续费') DECIMAL(11,4)"`
PaymentType int `json:"payment_type" xorm:"not null default 1 comment('1支付宝,2微信.3手动转账') TINYINT(1)"`
OrdType string `json:"ord_type" xorm:"not null default '' comment('订单类型taobao,jd,pdd,vip,suning,kaola,own自营,withdraw提现') VARCHAR(20)"`
OrdId string `json:"ord_id" xorm:"not null default '' comment('对应订单编号') VARCHAR(50)"`
OrdTitle string `json:"ord_title" xorm:"not null default '' comment('订单标题') VARCHAR(50)"`
OrdAction int `json:"ord_action" xorm:"not null default 0 comment('10自购,11推广,12团队,20提现,21消费') TINYINT(2)"`
OrdTime int `json:"ord_time" xorm:"not null default 0 comment('下单时间or提现时间') INT(11)"`
OrdDetail string `json:"ord_detail" xorm:"not null default '' comment('记录商品ID或提现账号') VARCHAR(50)"`
ExpectedTime string `json:"expected_time" xorm:"not null default '0' comment('预期到账时间,字符串用于直接显示,结算后清除内容') VARCHAR(30)"`
State int `json:"state" xorm:"not null default 1 comment('1未到账,2已到账') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(2000)"`
OtherId int64 `json:"other_id" xorm:"not null default 0 comment('其他关联订单,具体根据订单类型判断') BIGINT(20)"`
AliOrdId string `json:"ali_ord_id" xorm:"default '' comment('支付宝订单号') VARCHAR(128)"`
CreateAt time.Time `json:"create_at" xorm:"created not null default CURRENT_TIMESTAMP comment('创建时间') TIMESTAMP"`
UpdateAt time.Time `json:"update_at" xorm:"updated not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
TransferData string `json:"transfer_data" xorm:" TEXT"`
}

+ 19
- 0
consume/zhios_fast_return_order_pay.go Voir le fichier

@@ -13,6 +13,7 @@ import (
"fmt"
"github.com/streadway/amqp"
"github.com/tidwall/gjson"
"time"
"xorm.io/xorm"
)

@@ -147,10 +148,28 @@ func handleZhiosFastReturnOrderPay(msg []byte) error {
orderData.TransferSignId = sign.AlipayFundTransUniTransferResponse.OrderId
if sign.AlipayFundTransUniTransferResponse.Status == "SUCCESS" {
orderData.IsTransfer = 1
var flow = &model.FinUserFlow{
Type: 0,
Uid: orderData.Uid,
Amount: "",
PaymentType: 3,
BeforeAmount: "0",
AfterAmount: "0",
OrdType: "fast_return",
OrdId: utils.AnyToString(orderData.OrdId),
OrdAction: 103,
OrdTitle: "佣金到账" + money + "元(已到支付宝)",
State: 2,
OtherId: 0,
OrdTime: int(time.Now().Unix()),
CreateAt: time.Now(),
}
eg.Insert(flow)
} else {
orderData.IsTransfer = 2
}
eg.Where("ord_id=?", oid).Cols("is_transfer,transfer_sign_id").Update(&orderData)

} else {
fmt.Println(sign)
return errors.New("失败")


+ 18
- 0
consume/zhios_fast_return_order_refund.go Voir le fichier

@@ -12,6 +12,7 @@ import (
"errors"
"fmt"
"github.com/streadway/amqp"
"time"
)

func ZhiosFastReturnOrderRefund(queue md.MqQueue) {
@@ -146,5 +147,22 @@ func handleZhiosFastReturnOrderRefund(msg []byte) error {
args1 = CommInfo(eg, mid, args1)
pay.CreditagreementOrderFinish(args1)
}
var flow = &model.FinUserFlow{
Type: 1,
Uid: orderData.Uid,
Amount: "",
PaymentType: 3,
BeforeAmount: "0",
AfterAmount: "0",
OrdType: "fast_return",
OrdId: utils.AnyToString(orderData.OrdId),
OrdAction: 103,
OrdTitle: "秒返订单退款扣除" + money + "元(支付宝)",
State: 2,
OtherId: 0,
OrdTime: int(time.Now().Unix()),
CreateAt: time.Now(),
}
eg.Insert(flow)
return nil
}

Chargement…
Annuler
Enregistrer