diff --git a/app/db/db_life_order.go b/app/db/db_life_order.go index 513647f..9a17e5f 100644 --- a/app/db/db_life_order.go +++ b/app/db/db_life_order.go @@ -4,6 +4,7 @@ import ( "applet/app/db/model" "applet/app/utils" "fmt" + "strings" ) func GetLifeOrderByOne(oid, mid, types string) *model.LifeOrder { @@ -46,11 +47,19 @@ func GetLifeOrderList(args map[string]string) []model.LifeOrder { if args["uid"] != "" { sess = sess.And("uid=?", args["uid"]) } + if args["pvd"] != "" { + sess = sess.In("pvd", strings.Split(args["pvd"], ",")) + } if args["status"] != "" { - sess = sess.And("status=?", args["status"]) + sess = sess.In("status", strings.Split(args["status"], ",")) } if args["to_settle_time"] != "" { - sess = sess.And("platform_settle_time 0 { for _, v := range list { @@ -81,6 +82,7 @@ func GuideOrderOutput(c *gin.Context, args map[string]string) (string, map[strin "kuaishou": "快手", "kuaishou_live": "快手直播商品", "meituan": "美团", + "own_ele": "饿了么", } list, _ := db.GetGuideOrderListTotal(args) diff --git a/app/svc/platform/svc_life_order_list.go b/app/svc/platform/svc_life_order_list.go index 6375a82..fe4de4e 100644 --- a/app/svc/platform/svc_life_order_list.go +++ b/app/svc/platform/svc_life_order_list.go @@ -19,6 +19,7 @@ func LifeOrderList(c *gin.Context, args map[string]string) ([]map[string]string, "kuaishou": "快手", "kuaishou_live": "快手直播商品", "meituan": "美团", + "own_ele": "饿了么", } if len(list) > 0 { for _, v := range list { @@ -81,6 +82,7 @@ func LifeOrderOutput(c *gin.Context, args map[string]string) (string, map[string "kuaishou": "快手", "kuaishou_live": "快手直播商品", "meituan": "美团", + "own_ele": "饿了么", } list, _ := db.GetGuideOrderListTotal(args) diff --git a/app/task/init.go b/app/task/init.go index aad6655..6ba9583 100644 --- a/app/task/init.go +++ b/app/task/init.go @@ -123,4 +123,8 @@ func initTasks() { jobs[taskMd.ZhimengCronMeituanStoreOrder] = taskMeituanStoreOrder // jobs[taskMd.ZhimengCronLifeOrderSettle] = taskLifeOrderSettle // + jobs[taskMd.ZhimengCronElmOrder] = taskElmOrder // + jobs[taskMd.ZhimengCronDidiOrder] = taskDidiOrder // + jobs[taskMd.ZhimengCronT3Order] = taskT3Order // + } diff --git a/app/task/md/cron_key.go b/app/task/md/cron_key.go index 8e1a61e..641ede2 100644 --- a/app/task/md/cron_key.go +++ b/app/task/md/cron_key.go @@ -42,9 +42,14 @@ const ( ZhimengCronKuaishouOrder = "zhimeng_cron_kuaishou_order" ZhimengCronMeituanOrder = "zhimeng_cron_meituan_order" ZhimengCronMeituanStoreOrder = "zhimeng_cron_meituan_store_order" + ZhimengCronElmOrder = "zhimeng_cron_elm_order" + ZhimengCronT3Order = "zhimeng_cron_t3_order" + ZhimengCronDidiOrder = "zhimeng_cron_didi_order" ZhimengCronKuaishouAuth = "zhimeng_cron_kuaishou_auth" ZhimengCronTikTokLocalLifeOrder = "zhimeng_cron_tik_tok_local_life_order" ZhimengCronCsjpLocalLifeOrder = "zhimeng_cron_csjp_local_life_order" ZhimengCronTikTokLocalLifeOrderSettle = "zhimeng_cron_tik_tok_local_life_order_settle" ZhimengCronLifeOrderSettle = "zhimeng_cron_life_order_settle" + ZhimengCronSuccessLifeOrderSettle = "zhimeng_cron_success_life_order_settle" + ZhimengCronPayLifeOrderSettle = "zhimeng_cron_pay_life_order_settle" ) diff --git a/app/task/svc/svc_didi_order.go b/app/task/svc/svc_didi_order.go new file mode 100644 index 0000000..552eb5d --- /dev/null +++ b/app/task/svc/svc_didi_order.go @@ -0,0 +1,172 @@ +package svc + +import ( + "applet/app/db" + "applet/app/db/model" + offical "applet/app/db/official" + "applet/app/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/didi" + "fmt" + "strings" + "time" +) + +func DidiOrder() { + pvdTimeKey := "didi_time" + + // 获得最后时间 + latest := offical.SysCfgByKey(pvdTimeKey) + if latest == nil { + offical.DbsSysCfgInserts(pvdTimeKey, time.Now().String()) + latest = offical.SysCfgByKey(pvdTimeKey) + } + // 所有时间都是在操作秒数 + now := time.Now().Unix() + strs := strings.Split(latest.V, ":") + timeStr := latest.V + if len(strs) == 3 { + timeStr = strs[0] + ":" + strs[1] + ":00" + } + fmt.Println(timeStr) + past := utils.TimeParseStd(timeStr).Unix() + // 如果上次记录超过30天或者 过去时间大于当前时间戳, 把时间设置为此前20分钟 + if past < now-180*86400 || past > now { + past = now + } + var ( + beginTime int64 = 0 + endTime int64 = 0 + pageNo int = 1 + pageSize int = 50 + ) + + //怕时间不是走最新的 + leave := now - past + if leave > 500 { + leave = 0 + } + past = past + leave + beginTime = past - 300 + endTime = past + + if endTime > now { + endTime = now + } + + for { + count := 0 + count, _ = OrdersDidiGet(pageNo, pageSize, beginTime, endTime, "update", 1) + if count == 0 { + goto ChkArg + } + // 判断是否分页已经全部取完了 + if count <= pageSize { + pageNo++ + fmt.Println("========下一页========" + utils.IntToStr(pageNo)) + count = 0 + continue + } + ChkArg: + // 查询完后重置时间, 最后查询时间 + if endTime < now { + pageNo = 1 + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + beginTime = endTime + endTime = endTime + 300 + if endTime > now { + endTime = now + } + count = 0 + continue + } + count = 0 + break + } + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + +} + +func OrdersDidiGet(p int, pageSize int, sTime, eTime int64, timeType string, pvd int) (int, string) { + key := "42c22ffdc81caf4c9c0621492f10cd1c" + secret := "Pyqb416Pagi7kYC0CMxdIckNYdAyoyfy" + args := map[string]interface{}{ + "pay_end_time": eTime, + "pay_start_time": sTime, + "page": p, + "size": pageSize, + } + order := didi.GetDidiOrder(key, secret, args) + if order == nil || len(order) == 0 { + return 0, "" + } + + var stateList = map[int]string{ + 2: "订单付款", + 8: "订单失效", + } + typeArr := map[string]string{"159": "own_oilstation", "210": "own_didi_online_car", "393": "own_didi_freight", "500": "own_king_flower", "120": "own_didi_chauffeur"} + for _, v := range order { + status := stateList[v.OrderStatus] + var settleTime int64 = 0 + if v.Status >= 4 { + status = "订单结算" + settleTime = time.Now().Unix() + if v.Status == 6 { + status = "订单失效" + v.FailReason = "联盟判断不结算" + settleTime = 0 + } + } + var res = model.LifeOrder{ + PvdParentOid: v.OrderId, + Pvd: typeArr[utils.IntToStr(v.ProductId)], + Status: status, + CreateTime: v.PayTime, + } + if res.Pvd == "" { + res.Pvd = "own_didi_online_car" + } + ex := strings.Split(v.SourceId, "_") + if len(ex) < 4 || strings.Contains(v.SourceId, "own") == false { + continue + } + orderType := 0 + if ex[1] == "share" { + orderType = 1 + } + res.Ext = v.FailReason + res.Uid = utils.StrToInt(ex[2]) + res.StationUid = utils.StrToInt(ex[3]) + res.Oid = utils.StrToInt64(utils.OrderUUID(utils.StrToInt(ex[2]))) + res.PvdOid = v.OrderId + res.UpdateTime = int(time.Now().Unix()) + res.Title = v.Title + res.Gid = res.PvdOid + res.IsShare = orderType + res.Payment = utils.Float64ToStr(float64(v.PayPrice) / 100) + var commission = float64(v.CpsProfit) / 100 + if v.CpaProfit > 0 { + commission += float64(v.CpaProfit) / 100 * 0.5 + } + if settleTime > 0 { + res.PlatformSettleTime = int(settleTime) + } + res.Commission = utils.Float64ToStr(commission) + res.RealCommission = utils.Float64ToStr(commission) + one := db.GetLifeOrderByOne(res.PvdOid, utils.IntToStr(res.Uid), res.Pvd) + if one == nil { + insertOne, err := db.ZhimengDb.InsertOne(&res) + fmt.Println(insertOne) + fmt.Println(err) + } else { + res.SettleTime = one.SettleTime + res.CreateTime = one.CreateTime + if one.PlatformSettleTime > 0 { + res.PlatformSettleTime = one.PlatformSettleTime + } + db.ZhimengDb.Where("id=?", one.Id).AllCols().Update(&res) + } + + } + return len(order), "" +} diff --git a/app/task/svc/svc_elm_order.go b/app/task/svc/svc_elm_order.go new file mode 100644 index 0000000..4fea111 --- /dev/null +++ b/app/task/svc/svc_elm_order.go @@ -0,0 +1,174 @@ +package svc + +import ( + "applet/app/db" + "applet/app/db/model" + offical "applet/app/db/official" + "applet/app/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/elm" + "fmt" + "strings" + "time" +) + +func ElmOrder() { + pvdTimeKey := "elm_time" + + // 获得最后时间 + latest := offical.SysCfgByKey(pvdTimeKey) + if latest == nil { + offical.DbsSysCfgInserts(pvdTimeKey, time.Now().String()) + latest = offical.SysCfgByKey(pvdTimeKey) + } + // 所有时间都是在操作秒数 + now := time.Now().Unix() + strs := strings.Split(latest.V, ":") + timeStr := latest.V + if len(strs) == 3 { + timeStr = strs[0] + ":" + strs[1] + ":00" + } + fmt.Println(timeStr) + past := utils.TimeParseStd(timeStr).Unix() + // 如果上次记录超过30天或者 过去时间大于当前时间戳, 把时间设置为此前20分钟 + if past < now-180*86400 || past > now { + past = now + } + var ( + beginTime int64 = 0 + endTime int64 = 0 + pageNo int = 1 + pageSize int = 50 + ) + + //怕时间不是走最新的 + leave := now - past + if leave > 500 { + leave = 0 + } + past = past + leave + beginTime = past - 300 + endTime = past + + if endTime > now { + endTime = now + } + + for { + count := 0 + count, _ = OrdersElmGet(pageNo, pageSize, beginTime, endTime, "update", 1) + if count == 0 { + goto ChkArg + } + // 判断是否分页已经全部取完了 + if count <= pageSize { + pageNo++ + fmt.Println("========下一页========" + utils.IntToStr(pageNo)) + count = 0 + continue + } + ChkArg: + // 查询完后重置时间, 最后查询时间 + if endTime < now { + pageNo = 1 + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + beginTime = endTime + endTime = endTime + 300 + if endTime > now { + endTime = now + } + count = 0 + continue + } + count = 0 + break + } + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + +} + +func OrdersElmGet(p int, pageSize int, sTime, eTime int64, timeType string, pvd int) (int, string) { + key := "34319215" + secret := "bb07710660e60a321350a35e1e3b91e8" + args := map[string]string{ + "end_time": time.Unix(eTime, 0).Format("2006-01-02 15:04:05"), + "start_time": time.Unix(sTime, 0).Format("2006-01-02 15:04:05"), + "p": utils.IntToStr(p), + "size": utils.IntToStr(pageSize), + } + order, _ := elm.ElemePromotionOrder(key, secret, args) + if order == nil { + return 0, "" + } + + var stateList = map[string]string{ + "2": "订单付款", + "4": "订单完成", + "1": "创建订单", + "0": "订单失效", + } + + for _, v := range order.Result { + if *v.OrderState == 1 { + continue + } + createTime := utils.TimeStdParseUnix(*v.TkCreateTime) + if v.PayTime != nil { + createTime = utils.TimeStdParseUnix(*v.PayTime) + } + var res = model.LifeOrder{ + PvdParentOid: utils.Int64ToStr(*v.ParentOrderId), + Pvd: "own_ele", + Status: stateList[utils.Int64ToStr(*v.OrderState)], + CreateTime: int(createTime), + } + if *v.SettleState == 1 && v.SettleTime != nil { + res.Status = "订单结算" + res.PlatformSettleTime = int(utils.TimeStdParseUnix(*v.SettleTime)) + } + ex := strings.Split(*v.Sid, "_") + if len(ex) < 4 || strings.Contains(*v.Sid, "own") == false { + continue + } + orderType := 0 + if ex[1] == "share" { + orderType = 1 + } + res.Uid = utils.StrToInt(ex[2]) + res.StationUid = utils.StrToInt(ex[3]) + res.Oid = utils.StrToInt64(utils.OrderUUID(utils.StrToInt(ex[2]))) + res.PvdOid = utils.Int64ToStr(*v.BizOrderId) + res.UpdateTime = int(time.Now().Unix()) + if utils.StrToFloat64(*v.PlatformCommissionFee) == 0 { + amount := utils.StrToFloat64(*v.Income) + if utils.StrToFloat64(*v.Settle) > 0 { + amount = utils.StrToFloat64(*v.Settle) + } + fee := float64(int(amount*0.1*100)) / 100 + *v.PlatformCommissionFee = utils.Float64ToStr(fee) + } + res.Commission = utils.Float64ToStr(utils.StrToFloat64(*v.Income) - utils.StrToFloat64(*v.PlatformCommissionFee)) + if v.Settle != nil { + res.RealCommission = utils.Float64ToStr(utils.StrToFloat64(*v.Settle) - utils.StrToFloat64(*v.PlatformCommissionFee)) + } + res.Title = *v.Title + res.Img = *v.PicUrl + res.Gid = res.PvdOid + res.IsShare = orderType + res.Payment = *v.PayAmount + one := db.GetLifeOrderByOne(res.PvdOid, utils.IntToStr(res.Uid), res.Pvd) + if one == nil { + insertOne, err := db.ZhimengDb.InsertOne(&res) + fmt.Println(insertOne) + fmt.Println(err) + } else { + res.SettleTime = one.SettleTime + res.CreateTime = one.CreateTime + if one.PlatformSettleTime > 0 { + res.PlatformSettleTime = one.PlatformSettleTime + } + db.ZhimengDb.Where("id=?", one.Id).AllCols().Update(&res) + } + + } + return len(order.Result), "" +} diff --git a/app/task/svc/svc_life_order_settle.go b/app/task/svc/svc_life_order_settle.go index 683d7dd..cad7dd1 100644 --- a/app/task/svc/svc_life_order_settle.go +++ b/app/task/svc/svc_life_order_settle.go @@ -3,41 +3,25 @@ package svc import ( "applet/app/db" "applet/app/db/model" + "applet/app/md" "applet/app/utils" "applet/app/utils/cache" "fmt" "time" ) -func LifeOrderSettle() { +func LifeOrderSettle(arg map[string]string) { day := time.Now().Day() if day < 20 { return } - month := utils.GetTimeRange("current_month") - fmt.Println(month) - arg := map[string]string{ - "status": "订单结算", - "sort": "id desc", - "is_to_settle": "1", - "is_commission": "1", - "to_settle_time": utils.Int64ToStr(month["start"]), - "p": "1", - "size": "100", - } + order := db.GetLifeOrderList(arg) if len(order) == 0 { return } fmt.Println(utils.SerializeStr(order)) - platformMap := map[string]string{ - "tikTok_life": "抖音本地生活", - "csjp": "穿山甲抖音", - "csjp_live": "穿山甲抖音直播商品", - "kuaishou": "快手", - "kuaishou_live": "快手直播商品", - "meituan": "美团", - } + platformMap := md.SettlePvd for _, v := range order { fmt.Println("=================00") // 加锁 防止并发提取 diff --git a/app/task/svc/svc_t3_order.go b/app/task/svc/svc_t3_order.go new file mode 100644 index 0000000..acc28bd --- /dev/null +++ b/app/task/svc/svc_t3_order.go @@ -0,0 +1,174 @@ +package svc + +import ( + "applet/app/db" + "applet/app/db/model" + offical "applet/app/db/official" + "applet/app/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/t3" + "fmt" + "strings" + "time" +) + +func T3Order() { + pvdTimeKey := "t3_time" + + // 获得最后时间 + latest := offical.SysCfgByKey(pvdTimeKey) + if latest == nil { + offical.DbsSysCfgInserts(pvdTimeKey, time.Now().String()) + latest = offical.SysCfgByKey(pvdTimeKey) + } + // 所有时间都是在操作秒数 + now := time.Now().Unix() + strs := strings.Split(latest.V, ":") + timeStr := latest.V + if len(strs) == 3 { + timeStr = strs[0] + ":" + strs[1] + ":00" + } + fmt.Println(timeStr) + past := utils.TimeParseStd(timeStr).Unix() + // 如果上次记录超过30天或者 过去时间大于当前时间戳, 把时间设置为此前20分钟 + if past < now-180*86400 || past > now { + past = now + } + var ( + beginTime int64 = 0 + endTime int64 = 0 + pageNo int = 1 + pageSize int = 50 + ) + + //怕时间不是走最新的 + leave := now - past + if leave > 500 { + leave = 0 + } + past = past + leave + beginTime = past - 300 + endTime = past + + if endTime > now { + endTime = now + } + + for { + count := 0 + count, _ = OrdersT3Get(pageNo, pageSize, beginTime, endTime, "update", 1) + if count == 0 { + goto ChkArg + } + // 判断是否分页已经全部取完了 + if count <= pageSize { + pageNo++ + fmt.Println("========下一页========" + utils.IntToStr(pageNo)) + count = 0 + continue + } + ChkArg: + // 查询完后重置时间, 最后查询时间 + if endTime < now { + pageNo = 1 + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + beginTime = endTime + endTime = endTime + 300 + if endTime > now { + endTime = now + } + count = 0 + continue + } + count = 0 + break + } + offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) + +} + +func OrdersT3Get(p int, pageSize int, sTime, eTime int64, timeType string, pvd int) (int, string) { + args := map[string]string{ + "startTime": utils.Int64ToStr(sTime * 1000), + "endTime": utils.Int64ToStr(eTime * 1000), + "pageNo": utils.IntToStr(p), + "pageSize": utils.IntToStr(pageSize), + "supplierUuid": "3ab61dc6801f488ca085fb016d37cf68", + } + order := t3.GetT3Order("QOHEgCUTeK", "tsTSxrCgibcFbxGOxRDEBGQUhRVJLsFs", args) + if order == nil || len(order) == 0 { + return 0, "" + } + t3FirstCommission := db.ZhimengSysCfgGetOneData("t3_first_commission") + for _, v := range order { + status := "订单付款" + settleTime := 0 + if v.ParticipationStatus == 1 { + status = "订单结算" + settleTime = int(time.Now().Unix()) + } + if v.CreateTime == 0 { + v.CreateTime = time.Now().Unix() * 1000 + } + var res = model.LifeOrder{ + PvdParentOid: v.BusinessId, + Pvd: "own_t3car", + Status: status, + CreateTime: int(v.CreateTime / 1000), + } + ex := strings.Split(v.SourceId, "_") + if len(ex) < 4 || strings.Contains(v.SourceId, "own") == false { + continue + } + orderType := 0 + if ex[1] == "share" { + orderType = 1 + } + res.PlatformSettleTime = settleTime + res.Uid = utils.StrToInt(ex[2]) + res.StationUid = utils.StrToInt(ex[3]) + res.Oid = utils.StrToInt64(utils.OrderUUID(utils.StrToInt(ex[2]))) + res.PvdOid = v.BusinessId + res.UpdateTime = int(time.Now().Unix()) + res.Title = "T3打车" + res.Gid = res.PvdOid + res.IsShare = orderType + if v.PayAmount == 0 { + v.PayAmount = v.OrderAmount + } + res.Payment = utils.Float64ToStr(v.PayAmount) + var commission float64 = 0 + if v.ParticipationStatus == 1 { + if v.CpaType == "CPA" || v.CpaType == "NEW_CPA" { + if v.AttributionalFirstOrder { + commission = utils.StrToFloat64(t3FirstCommission) + } + } + if v.CpaType == "CPS" || v.CpaType == "NEW_CPS" { + commission = v.PayAmount * float64(v.Rate) / 100 + } + if v.CpaType == "CPA_CPS" || v.CpaType == "NEW_CPA_CPS" { + if v.AttributionalFirstOrder { + commission = utils.StrToFloat64(t3FirstCommission) + } + commission += v.PayAmount * float64(v.Rate) / 100 + } + } + res.Commission = utils.Float64ToStr(commission) + res.RealCommission = utils.Float64ToStr(commission) + one := db.GetLifeOrderByOne(res.PvdOid, utils.IntToStr(res.Uid), res.Pvd) + if one == nil { + insertOne, err := db.ZhimengDb.InsertOne(&res) + fmt.Println(insertOne) + fmt.Println(err) + } else { + res.SettleTime = one.SettleTime + res.CreateTime = one.CreateTime + if one.PlatformSettleTime > 0 { + res.PlatformSettleTime = one.PlatformSettleTime + } + db.ZhimengDb.Where("id=?", one.Id).AllCols().Update(&res) + } + + } + return len(order), "" +} diff --git a/app/task/svc/svc_tik_tok_local_life_order_settle.go b/app/task/svc/svc_tik_tok_local_life_order_settle.go index f2280e1..ef3e511 100644 --- a/app/task/svc/svc_tik_tok_local_life_order_settle.go +++ b/app/task/svc/svc_tik_tok_local_life_order_settle.go @@ -37,6 +37,7 @@ func TikTokLocalLifeOrderSettle() { "kuaishou": "快手", "kuaishou_live": "快手直播商品", "meituan": "美团", + "own_ele": "饿了么", } for _, v := range order { fmt.Println("=================00") diff --git a/app/task/task_didi_order.go b/app/task/task_didi_order.go new file mode 100644 index 0000000..e6864ef --- /dev/null +++ b/app/task/task_didi_order.go @@ -0,0 +1,21 @@ +package task + +import ( + "applet/app/task/svc" + "math/rand" + "time" +) + +func taskDidiOrder() { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + svc.DidiOrder() + <-ch +} diff --git a/app/task/task_elm_order.go b/app/task/task_elm_order.go new file mode 100644 index 0000000..89053ac --- /dev/null +++ b/app/task/task_elm_order.go @@ -0,0 +1,21 @@ +package task + +import ( + "applet/app/task/svc" + "math/rand" + "time" +) + +func taskElmOrder() { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + svc.ElmOrder() + <-ch +} diff --git a/app/task/task_life_order_settle.go b/app/task/task_life_order_settle.go index a0f71aa..49f1e2a 100644 --- a/app/task/task_life_order_settle.go +++ b/app/task/task_life_order_settle.go @@ -2,6 +2,8 @@ package task import ( "applet/app/task/svc" + "applet/app/utils" + "fmt" "math/rand" "time" ) @@ -16,6 +18,18 @@ func taskLifeOrderSettle() { } START: ch <- 1 - svc.LifeOrderSettle() + month := utils.GetTimeRange("current_month") + fmt.Println(month) + arg := map[string]string{ + "status": "订单结算", + "sort": "id desc", + "is_to_settle": "1", + "is_commission": "1", + "to_settle_time": utils.Int64ToStr(month["start"]), + "p": "1", + "size": "100", + //"pvd": "meituan,own_ele,own_didi_online_car,own_didi_freight,own_didi_chauffeur,own_oilstation,own_king_flower", + } + svc.LifeOrderSettle(arg) <-ch } diff --git a/app/task/task_pay_life_order_settle.go b/app/task/task_pay_life_order_settle.go new file mode 100644 index 0000000..35ca8b8 --- /dev/null +++ b/app/task/task_pay_life_order_settle.go @@ -0,0 +1,35 @@ +package task + +import ( + "applet/app/task/svc" + "applet/app/utils" + "fmt" + "math/rand" + "time" +) + +func taskPayLifeOrderSettle() { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + month := utils.GetTimeRange("current_month") + fmt.Println(month) + arg := map[string]string{ + "status": "订单付款", + "sort": "id desc", + "is_to_settle": "2", + "is_commission": "1", + "to_settle_time": utils.Int64ToStr(month["start"]), + "p": "1", + "size": "100", + "pvd": "own_didi_online_car,own_didi_freight,own_didi_chauffeur,own_oilstation,own_king_flower", + } + svc.LifeOrderSettle(arg) + <-ch +} diff --git a/app/task/task_success_life_order_settle.go b/app/task/task_success_life_order_settle.go new file mode 100644 index 0000000..3c1f48e --- /dev/null +++ b/app/task/task_success_life_order_settle.go @@ -0,0 +1,35 @@ +package task + +import ( + "applet/app/task/svc" + "applet/app/utils" + "fmt" + "math/rand" + "time" +) + +func taskSuccessLifeOrderSettle() { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + month := utils.GetTimeRange("current_month") + fmt.Println(month) + arg := map[string]string{ + "status": "订单完成,订单成功", + "sort": "id desc", + "is_to_settle": "2", + "is_commission": "1", + "to_settle_time": utils.Int64ToStr(month["start"]), + "p": "1", + "size": "100", + "pvd": "own_t3car", + } + svc.LifeOrderSettle(arg) + <-ch +} diff --git a/app/task/task_t3_order.go b/app/task/task_t3_order.go new file mode 100644 index 0000000..ca20169 --- /dev/null +++ b/app/task/task_t3_order.go @@ -0,0 +1,21 @@ +package task + +import ( + "applet/app/task/svc" + "math/rand" + "time" +) + +func taskT3Order() { + for { + if len(ch) > workerNum { + time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) + } else { + goto START + } + } +START: + ch <- 1 + svc.T3Order() + <-ch +} diff --git a/go.mod b/go.mod index b391db7..323565f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20230707081910-52e70aa52998 - code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240703022510-030b67bd5fdb + code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240731063657-03565dc21651 github.com/360EntSecGroup-Skylar/excelize v1.4.1 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/boombuler/barcode v1.0.1