From 1d56ce77f708e57df7d97269bd4edfc831bb1d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 15 Oct 2020 08:58:36 +0800 Subject: [PATCH] adduserbill --- business/jxstore/cms/order.go | 7 +------ business/jxstore/financial/bill.go | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/order.go b/business/jxstore/cms/order.go index b7653767a..1d28b9564 100644 --- a/business/jxstore/cms/order.go +++ b/business/jxstore/cms/order.go @@ -54,12 +54,7 @@ func Pay(ctx *jxcontext.Context, orderID, payType int, vendorPayType string) (er //如果用户没有对应账单信息就给他生成一条 userBill, err := dao.GetUserBill(db, order.UserID, "") if userBill == nil { - userBillInsert := &model.UserBill{ - BillID: jxutils.GenBillID(), - UserID: order.UserID, - } - dao.WrapAddIDCULDEntity(userBillInsert, jxcontext.AdminCtx.GetUserName()) - err = dao.CreateEntity(db, userBillInsert) + err = financial.AddUserBill(db, jxutils.GenBillID(), order.UserID) } err = payHandler.CreatePay() return err diff --git a/business/jxstore/financial/bill.go b/business/jxstore/financial/bill.go index 81f85dea9..fe3027079 100644 --- a/business/jxstore/financial/bill.go +++ b/business/jxstore/financial/bill.go @@ -25,3 +25,11 @@ func AddBillExpend(db *dao.DaoDB, billID int64, billType, expendPrice int) (err dao.WrapAddIDCULEntity(billExpend, jxcontext.AdminCtx.GetUserName()) return dao.CreateEntity(db, billExpend) } +func AddUserBill(db *dao.DaoDB, billID int64, userID string) (err error) { + userBillInsert := &model.UserBill{ + BillID: billID, + UserID: userID, + } + dao.WrapAddIDCULDEntity(userBillInsert, jxcontext.AdminCtx.GetUserName()) + return dao.CreateEntity(db, userBillInsert) +}