From 4bfb4666cdac1ff9830dae91926dd390cb2fed40 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 22 Jul 2022 16:05:03 +0800 Subject: [PATCH] add --- business/jxstore/financial/bill.go | 2 +- business/jxstore/financial/financial.go | 2 +- business/jxstore/financial/pay.go | 10 ++++------ business/model/order.go | 7 ++++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/business/jxstore/financial/bill.go b/business/jxstore/financial/bill.go index c1aea50c5..bb4d96d3b 100644 --- a/business/jxstore/financial/bill.go +++ b/business/jxstore/financial/bill.go @@ -169,7 +169,7 @@ func SettleUnionOrders(ctx *jxcontext.Context, vendorIDs []int) (err error) { func WXInvestMember(ctx *jxcontext.Context, memberID int, userID string, isFree bool) (errCode string, err error) { var db = dao.GetDB() - //获取用户当前用户信息 + //获取用户 当前会员信息 userMembers, err := dao.GetUserMember(db, userID, model.MemberTypeNormal) //获取用户微信下单信息 //userBill, err := dao.GetUserBill(db, userID, "") diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index efa068399..87c7ae487 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -269,7 +269,7 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) { payStatus = model.OrderStatusFailPay } //充值会员 增加微信支付处理业务 - if order.OrderType == 2 && call.TrxStatus == tonglianpayapi.TrxStatusSuccess { + if (order.OrderType == 2 || order.OrderType == 5) && call.TrxStatus == tonglianpayapi.TrxStatusSuccess { if err := OnWXPayFinished(order); err != nil { return err } diff --git a/business/jxstore/financial/pay.go b/business/jxstore/financial/pay.go index 11517adaa..8695d6f40 100644 --- a/business/jxstore/financial/pay.go +++ b/business/jxstore/financial/pay.go @@ -117,15 +117,13 @@ func OnWXPayFinished(order *model.Order) (err error) { } }() //获取用户会员信息 - userMember, err := dao.GetUserMember(db, order.UserID, model.UserStatusNormal) + //userMember, err := dao.GetUserMember(db, order.UserID, model.UserStatusNormal) //根据订单类型来操作账户 - switch order.Type { - case model.OrderTpyeMember: - //微信支付充值会员 - if _, err = WXInvestMember(ctx, userMember[0].MemberTypeID, order.UserID, true); err != nil { + if order.Type == 1 { + if _, err = WXInvestMember(ctx, order.OrderType, order.UserID, true); err != nil { dao.Rollback(db, txDB) } - default: + } else { globals.SugarLogger.Debugf("OnWXPayFinished 暂不支持此订单类型 order: %v", utils.Format4Output(order, false)) return fmt.Errorf("暂不支持此订单类型!") } diff --git a/business/model/order.go b/business/model/order.go index c8e80a8ec..9a74fb473 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -30,9 +30,10 @@ const ( OrderTypeCash = 2 //提现 OrderTypePublishJob = 1 //发布任务 - OrderTpyeMember = 2 //充值会员 + OrderTypeMember = 2 //充值会员月卡 + OrderTypeMemberYear = 5 //充值会员年卡 OrderTypeDelivery = 3 //发快递 - OrderTpyeDropShipping = 4 //一件代发交钱 + OrderTypeDropShipping = 4 //一件代发交钱 ) var ( @@ -58,7 +59,7 @@ type Order struct { OrderID string `orm:"column(order_id)" json:"orderID"` // 订单号 UserID string `orm:"column(user_id);size(48)" json:"userID"` // 用户ID Type int `json:"type"` // 支付还是提现 1-支付,2-提现 - OrderType int `json:"orderType"` // 订单类型,1-发任务,2-冲会员,3-发快递,4-提现 + OrderType int `json:"orderType"` // 订单类型,1-发任务,2-会员月卡,3-发快递,4-提现,5-会员年卡 Way string `json:"way"` // weixinapp ,weixinmini Status int `json:"status"` // 订单状态,待支付2,已支付5,支付成功110,支付失败115,150取消 PayPrice int `json:"payPrice"` // 支付金额