瀏覽代碼

更新

order_statistics
huangjiajun 3 月之前
父節點
當前提交
82a5772c0f
共有 1 個檔案被更改,包括 7 行新增7 行删除
  1. +7
    -7
      consume/canal_guide_order_for_statistics.go

+ 7
- 7
consume/canal_guide_order_for_statistics.go 查看文件

@@ -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)


Loading…
取消
儲存