Browse Source

更新

master
huangjiajun 4 months ago
parent
commit
388ffb935c
20 changed files with 734 additions and 28 deletions
  1. +11
    -2
      app/db/db_life_order.go
  2. +7
    -1
      app/db/db_sys_cfg.go
  3. +2
    -3
      app/hdl/zhimeng_platform/hdl_life_order_list.go
  4. +27
    -0
      app/md/settle_pvd.go
  5. +2
    -0
      app/svc/platform/svc_guide_order_list.go
  6. +2
    -0
      app/svc/platform/svc_life_order_list.go
  7. +4
    -0
      app/task/init.go
  8. +5
    -0
      app/task/md/cron_key.go
  9. +172
    -0
      app/task/svc/svc_didi_order.go
  10. +174
    -0
      app/task/svc/svc_elm_order.go
  11. +4
    -20
      app/task/svc/svc_life_order_settle.go
  12. +174
    -0
      app/task/svc/svc_t3_order.go
  13. +1
    -0
      app/task/svc/svc_tik_tok_local_life_order_settle.go
  14. +21
    -0
      app/task/task_didi_order.go
  15. +21
    -0
      app/task/task_elm_order.go
  16. +15
    -1
      app/task/task_life_order_settle.go
  17. +35
    -0
      app/task/task_pay_life_order_settle.go
  18. +35
    -0
      app/task/task_success_life_order_settle.go
  19. +21
    -0
      app/task/task_t3_order.go
  20. +1
    -1
      go.mod

+ 11
- 2
app/db/db_life_order.go View File

@@ -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<?", args["to_settle_time"])
if args["is_to_settle"] == "1" {
sess = sess.And("platform_settle_time<?", args["to_settle_time"])
}
if args["is_to_settle"] == "2" {
sess = sess.And("create_time<?", args["to_settle_time"])
}
}
sort := "update_time desc,id desc"
if args["sort"] != "" {


+ 7
- 1
app/db/db_sys_cfg.go View File

@@ -121,7 +121,13 @@ func (sysCfgDb *SysCfgDb) SysCfgDel(HKey string) error {
}
return nil
}

func ZhimengSysCfgGetOneData(key string) string {
var cfgList model.SysCfg
if has, err := ZhimengDb.Where("`key`=?", key).Get(&cfgList); err != nil || has == false {
return ""
}
return cfgList.V
}
func (sysCfgDb *SysCfgDb) SysCfgFindWithDb(keys ...string) map[string]string {
res := map[string]string{}
for _, v := range keys {


+ 2
- 3
app/hdl/zhimeng_platform/hdl_life_order_list.go View File

@@ -2,6 +2,7 @@ package zhimeng_platform

import (
"applet/app/e"
"applet/app/md"
"applet/app/svc/platform"
"applet/app/utils"
"github.com/gin-gonic/gin"
@@ -13,9 +14,7 @@ func LifeOrderList(c *gin.Context) {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
platformMap := map[string]string{
"meituan": "美团",
}
platformMap := md.LifeSettlePvd

data, total := platform.LifeOrderList(c, args)
var sourceList []map[string]string


+ 27
- 0
app/md/settle_pvd.go View File

@@ -0,0 +1,27 @@
package md

var SettlePvd = map[string]string{
"tikTok_life": "抖音本地生活",
"csjp": "穿山甲抖音",
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
"own_ele": "饿了么",
"own_t3car": "T3打车",
"own_didi_online_car": "滴滴打车",
"own_didi_freight": "滴滴货运",
"own_didi_chauffeur": "滴滴代驾",
"own_oilstation": "加油",
"own_king_flower": "花小猪打车",
}
var LifeSettlePvd = map[string]string{
"meituan": "美团",
"own_ele": "饿了么",
"own_t3car": "T3打车",
"own_didi_online_car": "滴滴打车",
"own_didi_freight": "滴滴货运",
"own_didi_chauffeur": "滴滴代驾",
"own_oilstation": "加油",
"own_king_flower": "花小猪打车",
}

+ 2
- 0
app/svc/platform/svc_guide_order_list.go View File

@@ -19,6 +19,7 @@ func GuideOrderList(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 GuideOrderOutput(c *gin.Context, args map[string]string) (string, map[strin
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
"own_ele": "饿了么",
}

list, _ := db.GetGuideOrderListTotal(args)


+ 2
- 0
app/svc/platform/svc_life_order_list.go View File

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


+ 4
- 0
app/task/init.go View File

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

}

+ 5
- 0
app/task/md/cron_key.go View File

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

+ 172
- 0
app/task/svc/svc_didi_order.go View File

@@ -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), ""
}

+ 174
- 0
app/task/svc/svc_elm_order.go View File

@@ -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), ""
}

+ 4
- 20
app/task/svc/svc_life_order_settle.go View File

@@ -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")
// 加锁 防止并发提取


+ 174
- 0
app/task/svc/svc_t3_order.go View File

@@ -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), ""
}

+ 1
- 0
app/task/svc/svc_tik_tok_local_life_order_settle.go View File

@@ -37,6 +37,7 @@ func TikTokLocalLifeOrderSettle() {
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
"own_ele": "饿了么",
}
for _, v := range order {
fmt.Println("=================00")


+ 21
- 0
app/task/task_didi_order.go View File

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

+ 21
- 0
app/task/task_elm_order.go View File

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

+ 15
- 1
app/task/task_life_order_settle.go View File

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

+ 35
- 0
app/task/task_pay_life_order_settle.go View File

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

+ 35
- 0
app/task/task_success_life_order_settle.go View File

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

+ 21
- 0
app/task/task_t3_order.go View File

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

+ 1
- 1
go.mod View File

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


Loading…
Cancel
Save