Bladeren bron

秒返

three
huangjiajun 1 jaar geleden
bovenliggende
commit
ce3ed17432
2 gewijzigde bestanden met toevoegingen van 50 en 0 verwijderingen
  1. +30
    -0
      app/db/model/fin_user_flow.go
  2. +20
    -0
      consume/zhios_fast_return_order_pay.go

+ 30
- 0
app/db/model/fin_user_flow.go Bestand weergeven

@@ -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"`
}

+ 20
- 0
consume/zhios_fast_return_order_pay.go Bestand weergeven

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

@@ -147,10 +148,29 @@ 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: "秒返到账" + money + "元(请到支付宝查看)",
PaymentType: 3,
BeforeAmount: "0",
AfterAmount: "0",
OrdType: "fast_return",
OrdId: utils.AnyToString(orderData.OrdId),
OrdAction: 103,
OrdDetail: "",
State: 2,
OtherId: 0,
OrdTitle: "",
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("失败")


Laden…
Annuleren
Opslaan