diff --git a/app/db/db_life_order.go b/app/db/db_life_order.go index 88ad814..f6ff990 100644 --- a/app/db/db_life_order.go +++ b/app/db/db_life_order.go @@ -16,6 +16,15 @@ func GetLifeOrderByOne(oid, mid, types string) *model.LifeOrder { } return &data } +func GetLifeOrderByOne1(oid, types string) *model.LifeOrder { + var data model.LifeOrder + get, err := ZhimengDb.Where(" pvd_oid=? and pvd=?", oid, types).Get(&data) + if get == false || err != nil { + fmt.Println(err) + return nil + } + return &data +} func GetLifeOrderList(args map[string]string) []model.LifeOrder { /*** p 页数 diff --git a/app/task/svc/svc_meituan_order.go b/app/task/svc/svc_meituan_order.go index 5a764d0..c704135 100644 --- a/app/task/svc/svc_meituan_order.go +++ b/app/task/svc/svc_meituan_order.go @@ -152,6 +152,13 @@ func OrdersMeituanGet(nextPositionIndex string, pageSize int, sTime, eTime int64 if v.UpdateTime > 0 && v.Status == "6" { res.PlatformSettleTime = v.UpdateTime } + one := db.GetLifeOrderByOne1(v.OrderId, res.Pvd) + if one != nil { + v.Sid = "own_" + utils.IntToStr(one.Uid) + "_" + utils.IntToStr(one.StationUid) + if one.IsShare == 1 { + v.Sid = "share_" + utils.IntToStr(one.Uid) + "_" + utils.IntToStr(one.StationUid) + } + } ex := strings.Split(v.Sid, "_") if len(ex) < 3 || strings.Contains(v.Sid, "ddstar") || strings.Contains(v.Sid, "ygd") { continue @@ -178,9 +185,12 @@ func OrdersMeituanGet(nextPositionIndex string, pageSize int, sTime, eTime int64 if utils.StrToInt(utils.AnyToString(v2["couponStatus"])) < utils.StrToInt(state) { state = utils.AnyToString(v2["couponStatus"]) } - if utils.InArr(utils.AnyToString(v2["couponStatus"]), []string{"1", "2", "3"}) { + if utils.InArr(utils.AnyToString(v2["couponStatus"]), []string{"1", "2"}) { allEnd = "0" } + if utils.InArr(utils.AnyToString(v2["couponStatus"]), []string{"4"}) { + continue + } Profit = zhios_third_party_utils.Float64ToStr(utils.StrToFloat64(Profit) + utils.AnyToFloat64(v2["couponFee"])) } } @@ -205,7 +215,6 @@ func OrdersMeituanGet(nextPositionIndex string, pageSize int, sTime, eTime int64 res.Gid = v.ProductId res.IsShare = orderType res.Payment = v.PayPrice - one := db.GetLifeOrderByOne(res.PvdOid, utils.IntToStr(res.Uid), res.Pvd) if one == nil { insertOne, err := db.ZhimengDb.InsertOne(&res) fmt.Println(insertOne) @@ -220,5 +229,6 @@ func OrdersMeituanGet(nextPositionIndex string, pageSize int, sTime, eTime int64 } } + return len(list), newPcursor }