From ce3ed174325b88844c4ebc279876b56c3cbc5d0b Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 15 Apr 2023 13:35:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=A7=92=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/model/fin_user_flow.go | 30 ++++++++++++++++++++++++++ consume/zhios_fast_return_order_pay.go | 20 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/db/model/fin_user_flow.go diff --git a/app/db/model/fin_user_flow.go b/app/db/model/fin_user_flow.go new file mode 100644 index 0000000..83ff113 --- /dev/null +++ b/app/db/model/fin_user_flow.go @@ -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"` +} diff --git a/consume/zhios_fast_return_order_pay.go b/consume/zhios_fast_return_order_pay.go index 1d2b4e8..2658684 100644 --- a/consume/zhios_fast_return_order_pay.go +++ b/consume/zhios_fast_return_order_pay.go @@ -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("失败") From 82f99d77c9cf808a55dd217f3af9fccdc3bc1076 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 15 Apr 2023 13:44:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=A7=92=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/zhios_fast_return_order_pay.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/consume/zhios_fast_return_order_pay.go b/consume/zhios_fast_return_order_pay.go index 2658684..5b61490 100644 --- a/consume/zhios_fast_return_order_pay.go +++ b/consume/zhios_fast_return_order_pay.go @@ -151,17 +151,16 @@ func handleZhiosFastReturnOrderPay(msg []byte) error { var flow = &model.FinUserFlow{ Type: 0, Uid: orderData.Uid, - Amount: "秒返到账" + money + "元(请到支付宝查看)", + Amount: "", PaymentType: 3, BeforeAmount: "0", AfterAmount: "0", OrdType: "fast_return", OrdId: utils.AnyToString(orderData.OrdId), OrdAction: 103, - OrdDetail: "", + OrdTitle: "秒返到账" + money + "元(请到支付宝查看)", State: 2, OtherId: 0, - OrdTitle: "", OrdTime: int(time.Now().Unix()), CreateAt: time.Now(), } From 0b37cf0098b57b6e4fb5f37422ddb14ed432cd4a Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 15 Apr 2023 14:04:08 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=A7=92=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/zhios_fast_return_order_refund.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/consume/zhios_fast_return_order_refund.go b/consume/zhios_fast_return_order_refund.go index c28b467..52c816a 100644 --- a/consume/zhios_fast_return_order_refund.go +++ b/consume/zhios_fast_return_order_refund.go @@ -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 } From d14530f39a885a055b4ed822d06d97cd0ef3b1a3 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Sat, 15 Apr 2023 14:39:27 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=A7=92=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/zhios_fast_return_order_pay.go | 2 +- consume/zhios_fast_return_order_refund.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/consume/zhios_fast_return_order_pay.go b/consume/zhios_fast_return_order_pay.go index 5b61490..37e2af4 100644 --- a/consume/zhios_fast_return_order_pay.go +++ b/consume/zhios_fast_return_order_pay.go @@ -158,7 +158,7 @@ func handleZhiosFastReturnOrderPay(msg []byte) error { OrdType: "fast_return", OrdId: utils.AnyToString(orderData.OrdId), OrdAction: 103, - OrdTitle: "秒返到账" + money + "元(请到支付宝查看)", + OrdTitle: "秒返到账" + money + "元(支付宝)", State: 2, OtherId: 0, OrdTime: int(time.Now().Unix()), diff --git a/consume/zhios_fast_return_order_refund.go b/consume/zhios_fast_return_order_refund.go index 52c816a..4f35769 100644 --- a/consume/zhios_fast_return_order_refund.go +++ b/consume/zhios_fast_return_order_refund.go @@ -157,7 +157,7 @@ func handleZhiosFastReturnOrderRefund(msg []byte) error { OrdType: "fast_return", OrdId: utils.AnyToString(orderData.OrdId), OrdAction: 103, - OrdTitle: "秒返订单退款扣除" + money + "元(请到支付宝查看)", + OrdTitle: "秒返订单退款扣除" + money + "元(支付宝)", State: 2, OtherId: 0, OrdTime: int(time.Now().Unix()), From fbfd91078efe85ca79063dffc3b7817cbbd8aa52 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 18 Apr 2023 11:29:35 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=A7=92=E8=BF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/zhios_fast_return_order_pay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consume/zhios_fast_return_order_pay.go b/consume/zhios_fast_return_order_pay.go index 37e2af4..a492c12 100644 --- a/consume/zhios_fast_return_order_pay.go +++ b/consume/zhios_fast_return_order_pay.go @@ -158,7 +158,7 @@ func handleZhiosFastReturnOrderPay(msg []byte) error { OrdType: "fast_return", OrdId: utils.AnyToString(orderData.OrdId), OrdAction: 103, - OrdTitle: "秒返到账" + money + "元(支付宝)", + OrdTitle: "佣金到账" + money + "元(已到支付宝)", State: 2, OtherId: 0, OrdTime: int(time.Now().Unix()),