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