|
@@ -363,21 +363,30 @@ func GetFinishCount(params map[string]string, blockStarChain string, engine *xor |
|
|
var payOrdId int64 |
|
|
var payOrdId int64 |
|
|
switch task.TaskType { |
|
|
switch task.TaskType { |
|
|
case 20: |
|
|
case 20: |
|
|
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") |
|
|
|
|
|
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;` |
|
|
|
|
|
nativeString, _ := db.QueryNativeString(engine, sql) |
|
|
|
|
|
money = withdrawingSuccess |
|
|
|
|
|
for _, v := range nativeString { |
|
|
|
|
|
money += zhios_condition_statistics_utils.StrToFloat64(v["amount"]) |
|
|
|
|
|
|
|
|
var money float64 = 0 |
|
|
|
|
|
shownewFinTotal, _ := db.SysCfgGetOne(engine, "shownew_fin_total") |
|
|
|
|
|
if shownewFinTotal != nil && shownewFinTotal.Val == "1" { |
|
|
|
|
|
var userStatistics model.UserStatistics |
|
|
|
|
|
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") |
|
|
|
|
|
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;` |
|
|
|
|
|
nativeString, _ := db.QueryNativeString(engine, sql) |
|
|
|
|
|
money = withdrawingSuccess |
|
|
|
|
|
for _, v := range nativeString { |
|
|
|
|
|
money += zhios_condition_statistics_utils.StrToFloat64(v["amount"]) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return zhios_condition_statistics_utils.Float64ToStr(money), hasPay, payOrdId |
|
|
return zhios_condition_statistics_utils.Float64ToStr(money), hasPay, payOrdId |
|
|
case 22: |
|
|
case 22: |
|
|
lvTime := db.GetOneCirclesUserLvTime(engine, uid) |
|
|
lvTime := db.GetOneCirclesUserLvTime(engine, uid) |
|
|