|
|
@@ -68,7 +68,7 @@ func InstallmentPaymentAutoRepaid(engine *xorm.Engine, masterId string, ch *rabb |
|
|
|
} |
|
|
|
|
|
|
|
// DealInstallmentPaymentAutoRepaid 处理分期付自动还款 |
|
|
|
func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPaymentStructForAutoRepaid, masterId string) (err error) { |
|
|
|
func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, ch *rabbit.Channel, args md.InstallmentPaymentStructForAutoRepaid, masterId string) (err error) { |
|
|
|
now := time.Now() |
|
|
|
session := engine.NewSession() |
|
|
|
defer func() { |
|
|
@@ -109,6 +109,7 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa |
|
|
|
} |
|
|
|
|
|
|
|
//3、新增`installment_payment_repaid_flow`数据 |
|
|
|
oid := zhios_order_relate_utils.OrderUUID(installmentPaymentList.Uid) |
|
|
|
installmentPaymentRepaidFlowDb := implement.NewInstallmentPaymentRepaidFlowDb(engine) |
|
|
|
_, err = installmentPaymentRepaidFlowDb.InsertInstallmentPaymentRepaidFlowBySession(session, &models.InstallmentPaymentRepaidFlow{ |
|
|
|
RecordId: installmentPaymentList.Id, |
|
|
@@ -117,6 +118,7 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa |
|
|
|
WhichRepaymentPeriod: installmentPaymentList.AlreadyRepaidInstallmentNums, |
|
|
|
CreateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
UpdateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
OrdId: zhios_order_relate_utils.StrToInt64(oid), |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
session.Rollback() |
|
|
@@ -138,5 +140,17 @@ func DealInstallmentPaymentAutoRepaid(engine *xorm.Engine, args md.InstallmentPa |
|
|
|
session.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
rewardData := md.ZhiosTaskReward{ |
|
|
|
Uid: zhios_order_relate_utils.IntToStr(installmentPaymentList.Uid), |
|
|
|
Mid: masterId, |
|
|
|
Reward: zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(installmentPaymentList.Commission)), |
|
|
|
Title: "分期付自动还款", |
|
|
|
Oid: oid, |
|
|
|
Provider: "installment_payment", |
|
|
|
} |
|
|
|
err1 := ch.PublishV2(md.RelateReward, zhios_order_relate_utils.SerializeStr(rewardData), md.RelateRewardData) |
|
|
|
if err1 != nil { |
|
|
|
ch.PublishV2(md.RelateReward, zhios_order_relate_utils.SerializeStr(rewardData), md.RelateRewardData) |
|
|
|
} |
|
|
|
return |
|
|
|
} |