Ver código fonte

更新

master
huangjiajun 5 meses atrás
pai
commit
2a81534fda
1 arquivos alterados com 26 adições e 6 exclusões
  1. +26
    -6
      hdl/hdl_upgrade.go

+ 26
- 6
hdl/hdl_upgrade.go Ver arquivo

@@ -370,15 +370,35 @@ func GetFinishCount(params map[string]string, blockStarChain string, engine *xor
engine.Where("uid=?", uid).Get(&userStatistics)
money = zhios_condition_statistics_utils.StrToFloat64(userStatistics.ImportFinTotal) + zhios_condition_statistics_utils.StrToFloat64(userStatistics.FinTotal)
} else {
sum, _ := engine.Where("type=0 and uid=?", uid).Sum(&model.FinUserFlow{}, "amount")
mallSum, _ := engine.Where("uid=? AND type=? and ord_title=?", uid, 1, "订单退款").Sum(&model.FinUserFlow{}, "amount")
deSum2, _ := engine.Where("uid=? AND type=? and ord_type=?", uid, 0, "withdraw").Sum(&model.FinUserFlow{}, "amount")
deSum3, _ := engine.Where("uid=? AND type=? and ord_title like ?", uid, 1, "%扣除%").Sum(&model.FinUserFlow{}, "amount")
sumWhere := engine.Where("type=0 and uid=?", uid)
mallSumWhere := engine.Where("uid=? AND type=? and ord_title=?", uid, 1, "订单退款")
deSum2Where := engine.Where("uid=? AND type=? and ord_type=?", uid, 0, "withdraw")
deSum3Where := engine.Where("uid=? AND type=? and ord_title like ?", uid, 1, "%扣除%")
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location())
etime := t
if task.WithinDays > 0 {
sqlStr4 := fmt.Sprintf(" %s >'%s' AND %s < '%s'", "create_at", stime.Format("2006-01-02 15:04:05"), "create_at", etime.Format("2006-01-02 15:04:05"))
sumWhere = sumWhere.And(sqlStr4)
mallSumWhere = mallSumWhere.And(sqlStr4)
deSum2Where = deSum2Where.And(sqlStr4)
deSum3Where = deSum3Where.And(sqlStr4)
}
sum, _ := sumWhere.Sum(&model.FinUserFlow{}, "amount")
mallSum, _ := mallSumWhere.Sum(&model.FinUserFlow{}, "amount")
deSum2, _ := deSum2Where.Sum(&model.FinUserFlow{}, "amount")
deSum3, _ := deSum3Where.Sum(&model.FinUserFlow{}, "amount")
dsCheck, _ := db.SysCfgGetOne(engine, "ds_check")
money = sum - deSum2 - deSum3 + mallSum
if dsCheck != nil && dsCheck.Val == "1" {
withdrawingSuccess, _ := engine.Where("uid=? ", uid).In("state", []string{"1", "2"}).Sum(&model.FinWithdrawApply{}, "amount")
sql := `SELECT cast(SUM(LEFT(olr.amount,LENGTH(olr.amount)-2)) as decimal(50,4)) AS amount FROM ord_list_relate olr JOIN ord_list ol ON olr.oid = ol.ord_id WHERE olr.level=0 and olr.uid = " . $uid . " AND ol.state IN (0,1,2,3) and ol.is_transfer=1;`
sess := engine.Where("uid=? ", uid).In("state", []string{"1", "2"})
where1 := ""
if task.WithinDays > 0 {
sqlStr4 := fmt.Sprintf(" %s >'%s' AND %s < '%s'", "create_at", stime.Format("2006-01-02 15:04:05"), "create_at", etime.Format("2006-01-02 15:04:05"))
where1 = fmt.Sprintf("AND %s >'%d' AND %s < '%d'", "create_at", stime.Unix(), "create_at", etime.Unix())
sess = sess.And(sqlStr4)
}
withdrawingSuccess, _ := sess.Sum(&model.FinWithdrawApply{}, "amount")
sql := "SELECT cast(SUM(LEFT(olr.amount,LENGTH(olr.amount)-2)) as decimal(50,4)) AS amount FROM ord_list_relate olr JOIN ord_list ol ON olr.oid = ol.ord_id WHERE olr.level=0 and olr.uid = " + zhios_condition_statistics_utils.AnyToString(uid) + " " + where1 + " AND ol.state IN (0,1,2,3) and ol.is_transfer=1;"
nativeString, _ := db.QueryNativeString(engine, sql)
money = withdrawingSuccess
for _, v := range nativeString {


Carregando…
Cancelar
Salvar