|
@@ -70,14 +70,14 @@ func CanalGuideOrderForStatisticsDetail(msg []byte, geoIp2db *geoip2.DBReader) e |
|
|
for _, data := range canalMsg.Data { |
|
|
for _, data := range canalMsg.Data { |
|
|
|
|
|
|
|
|
if utils.StrToInt(data.PvdSettleAt) > 0 && strings.Contains(data.Ext, "pvd_settle_at") == false { |
|
|
if utils.StrToInt(data.PvdSettleAt) > 0 && strings.Contains(data.Ext, "pvd_settle_at") == false { |
|
|
err = comm(sess, data.OrdId, data.BenefitAll, "pvd_settle", data.PvdSettleAt, data.Pvd) |
|
|
|
|
|
|
|
|
err = comm(sess, data.OrdId, data.BenefitAll, "pvd_settle_at", data.PvdSettleAt, data.Pvd) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
sess.Rollback() |
|
|
sess.Rollback() |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if utils.StrToInt(data.SettleAt) > 0 && strings.Contains(data.Ext, "settle_at") == false { |
|
|
|
|
|
err = comm(sess, data.OrdId, data.BenefitAll, "settle", data.SettleAt, data.Pvd) |
|
|
|
|
|
|
|
|
if utils.StrToInt(data.SettleAt) > 0 && strings.Contains(data.Ext, "station_settle_at") == false { |
|
|
|
|
|
err = comm(sess, data.OrdId, data.BenefitAll, "station_settle_at", data.SettleAt, data.Pvd) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
sess.Rollback() |
|
|
sess.Rollback() |
|
|
return err |
|
|
return err |
|
@@ -93,10 +93,10 @@ func comm(sess *xorm.Session, oid, commission, types, times, pvd string) error { |
|
|
if byOid == nil { |
|
|
if byOid == nil { |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
if strings.Contains(byOid.Ext, "settle") && types == "settle" { |
|
|
|
|
|
|
|
|
if strings.Contains(byOid.Ext, "station_settle_at") && types == "station_settle_at" { |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
if strings.Contains(byOid.Ext, "pvd_settle") && types == "pvd_settle" { |
|
|
|
|
|
|
|
|
if strings.Contains(byOid.Ext, "pvd_settle_at") && types == "pvd_settle_at" { |
|
|
return nil |
|
|
return nil |
|
|
} |
|
|
} |
|
|
extData := make(map[string]interface{}) |
|
|
extData := make(map[string]interface{}) |
|
@@ -121,7 +121,7 @@ func comm(sess *xorm.Session, oid, commission, types, times, pvd string) error { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if types == "settle" { |
|
|
|
|
|
|
|
|
if types == "station_settle_at" { |
|
|
sql := `select sum(amount) as amount from ord_list_relate where oid=%s ` |
|
|
sql := `select sum(amount) as amount from ord_list_relate where oid=%s ` |
|
|
sql = fmt.Sprintf(sql, oid) |
|
|
sql = fmt.Sprintf(sql, oid) |
|
|
data, _ := db.QueryNativeStringWithSession(sess, sql) |
|
|
data, _ := db.QueryNativeStringWithSession(sess, sql) |
|
@@ -129,7 +129,7 @@ func comm(sess *xorm.Session, oid, commission, types, times, pvd string) error { |
|
|
total.StationSettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(total.StationSettleAmount)+utils.StrToFloat64(data[0]["amount"]), 6) |
|
|
total.StationSettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(total.StationSettleAmount)+utils.StrToFloat64(data[0]["amount"]), 6) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if types == "pvd_settle" { |
|
|
|
|
|
|
|
|
if types == "pvd_settle_at" { |
|
|
total.UnionSettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(total.UnionSettleAmount)+utils.StrToFloat64(commission), 6) |
|
|
total.UnionSettleAmount = utils.Float64ToStrByPrec(utils.StrToFloat64(total.UnionSettleAmount)+utils.StrToFloat64(commission), 6) |
|
|
} |
|
|
} |
|
|
_, err := sess.Where("id=?", total.Id).Update(total) |
|
|
_, err := sess.Where("id=?", total.Id).Update(total) |
|
|