|
@@ -85,7 +85,8 @@ func (p *projectPay) SpecialSettlePay(ctx *gin.Context, req *http_model.SpecialS
|
|
|
logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err)
|
|
|
return err
|
|
|
}
|
|
|
- if balance < req.Amount {
|
|
|
+ realPay := req.Amount * 1.05
|
|
|
+ if balance < realPay {
|
|
|
return errors.New("余额不足")
|
|
|
}
|
|
|
err = tx.Model(&gorm_model.YoungeeTaskInfo{}).Where("task_id = ?", req.TaskId).Updates(gorm_model.YoungeeTaskInfo{
|
|
@@ -100,7 +101,7 @@ func (p *projectPay) SpecialSettlePay(ctx *gin.Context, req *http_model.SpecialS
|
|
|
return err
|
|
|
}
|
|
|
err = tx.Model(&gorm_model.Enterprise{}).Where("enterprise_id = ?", req.EnterPriseId).
|
|
|
- Updates(map[string]interface{}{"balance": gorm.Expr("balance - ?", req.Amount), "available_balance": gorm.Expr("available_balance - ?", req.Amount),
|
|
|
+ Updates(map[string]interface{}{"balance": gorm.Expr("balance - ?", realPay), "available_balance": gorm.Expr("available_balance - ?", realPay),
|
|
|
"updated_at": time.Now()}).Error
|
|
|
if err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err)
|