|
|
@@ -85,7 +85,7 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask |
|
|
|
//1、统计当前拥有多少份消费补贴 |
|
|
|
startAt := time.Now().Add(time.Duration(subsidyBase.ConsumptionDay) * -24 * time.Hour).Format("2006-01-02") //起始时间 |
|
|
|
var subsidyWithUserForConsumeList []model.SubsidyWithUser |
|
|
|
hasConsumeTotal, err := session.Where("date <= ?", startAt).And("kind = ?", 1).FindAndCount(&subsidyWithUserForConsumeList) |
|
|
|
hasConsumeTotal, err := session.Where("date <= ?", startAt).And("kind = ? and is_can_subsidy=?", 1, 1).FindAndCount(&subsidyWithUserForConsumeList) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
@@ -106,7 +106,7 @@ func DailySettlementBlockConsumeIntegral(engine *xorm.Engine, mid string, isTask |
|
|
|
|
|
|
|
//2、统计当前拥有多少份体验补贴 |
|
|
|
var subsidyWithUserForExperienceList []model.SubsidyWithUser |
|
|
|
hasExperienceTotal, err := session.Where("date <= ?", startAt).And("kind = ?", 2).FindAndCount(&subsidyWithUserForExperienceList) |
|
|
|
hasExperienceTotal, err := session.Where("date <= ?", startAt).And("kind = ? and is_can_subsidy=?", 2, 1).FindAndCount(&subsidyWithUserForExperienceList) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
} |
|
|
@@ -256,9 +256,12 @@ func DealUserExperienceIntegral(session *xorm.Session, subsidyWithUser *model.Su |
|
|
|
//2、新增 subsidy_with_user_flow 记录 |
|
|
|
var subsidyWitUserFlow = &model.SubsidyWithUserFlow{ |
|
|
|
RecordsId: subsidyWithUser.Id, |
|
|
|
Uid: subsidyWithUser.Uid, |
|
|
|
Kind: subsidyWithUser.Kind, |
|
|
|
Amount: zhios_order_relate_utils.Float64ToStr(experienceIntegralValue), |
|
|
|
BalanceAmount: zhios_order_relate_utils.Float64ToStr(afterAmount), |
|
|
|
CreateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
Month: zhios_order_relate_utils.StrToInt(now.Format("200601")), |
|
|
|
UpdateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
} |
|
|
|
insertAffected, err := db.SubsidyWithUserFlowInsert(session, subsidyWitUserFlow) |
|
|
@@ -268,8 +271,19 @@ func DealUserExperienceIntegral(session *xorm.Session, subsidyWithUser *model.Su |
|
|
|
if insertAffected <= 0 { |
|
|
|
return errors.New("新增 subsidy_with_user_flow 记录失败") |
|
|
|
} |
|
|
|
|
|
|
|
//3、给用户添加余额 |
|
|
|
//3、加入每月统计 |
|
|
|
if experienceIntegralValue > 0 { |
|
|
|
var subsidyWitUserMonth = &model.SubsidyWithUserMonth{ |
|
|
|
Uid: subsidyWithUser.Uid, |
|
|
|
Amount: zhios_order_relate_utils.Float64ToStr(experienceIntegralValue), |
|
|
|
Date: now.Format("2006-01"), |
|
|
|
} |
|
|
|
_, err1 := db.SubsidyWithMonthInsert(session, subsidyWitUserMonth) |
|
|
|
if err1 != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
//4、给用户添加余额 |
|
|
|
orderType := enum.FinUserFlowOrderActionString(md.ExperienceSubsidyOrdActionForFinUserFlow) |
|
|
|
var dealUserAmount = md.DealUserAmount{ |
|
|
|
Kind: "add", |
|
|
|