Kaynağa Gözat

更新

master
huangjiajun 5 ay önce
ebeveyn
işleme
4b3a6f6f3b
6 değiştirilmiş dosya ile 163 ekleme ve 2 silme
  1. +1
    -1
      app/hdl/hdl_file_upload.go
  2. +1
    -0
      app/task/init.go
  3. +1
    -0
      app/task/md/cron_key.go
  4. +138
    -0
      app/task/svc/svc_csjp_local_life_order.go
  5. +21
    -0
      app/task/task_csjp_life_order.go
  6. +1
    -1
      go.mod

+ 1
- 1
app/hdl/hdl_file_upload.go
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 0
app/task/init.go Dosyayı Görüntüle

@@ -115,6 +115,7 @@ func initTasks() {
jobs[taskMd.ZhimengCronHwDeliveryOrder] = taskHwDeliveryOrder //
jobs[taskMd.ZhimengCronHwTourismOrder] = taskHwTourismOrder //
jobs[taskMd.ZhimengCronTikTokLocalLifeOrder] = taskTikTokLocalLifeOrder //
jobs[taskMd.ZhimengCronCsjpLocalLifeOrder] = taskCsjpLocalLifeOrder //
jobs[taskMd.ZhimengCronTikTokLocalLifeOrderSettle] = taskTikTokLocalLifeOrderSettle //
jobs[taskMd.ZhimengCronKuaishouOrder] = taskKuaishouOrder //
jobs[taskMd.ZhimengCronKuaishouAuth] = taskKuaishouAuth //


+ 1
- 0
app/task/md/cron_key.go Dosyayı Görüntüle

@@ -43,6 +43,7 @@ const (
ZhimengCronMeituanOrder = "zhimeng_cron_meituan_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"
)

+ 138
- 0
app/task/svc/svc_csjp_local_life_order.go Dosyayı Görüntüle

@@ -0,0 +1,138 @@
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/md/csjp"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok"
"fmt"
"strings"
"time"
)

func CsjpLocalLifeOrder() {

p := ""
for true {
_, curor, hasMore := GetCsjpLocalLifeOrder(p)
if hasMore == false {
break
}
p = curor
}

}

func GetCsjpLocalLifeOrder(p string) (int, string, bool) {
endTime := time.Now().Unix()
startTime := endTime - 3600
tikTokCsjpAppId := offical.SysCfgByKeyStr("tik_tok_csjp_life_app_id")
tikTokCsjpAppSecret := offical.SysCfgByKeyStr("tik_tok_csjp_life_app_secret")
param := map[string]string{
"cursor": p,
"count": "50",
"update_time_begin": utils.Int64ToStr(startTime),
"update_time_end": utils.Int64ToStr(endTime),
}
param["app_id"] = tikTokCsjpAppId
param["app_secret"] = tikTokCsjpAppSecret
data, cursor, hasMore := tik_tok.CsjpLifeGetOrder(param)
count := 0
if data != nil {
for _, v := range *data {
AddCsjpLocalLifeOrder(v)
}
return count, utils.Int64ToStr(cursor), hasMore
}
return count, "", false
}
func AddCsjpLocalLifeOrder(order csjp.CsjpOrder) {

statusArr := map[int]string{1: "订单付款", 2: "订单退款", 3: "订单成功", 4: "部分核销", 5: "部分退款"}
userId := order.CommandExternalInfo
isShare := 0
if strings.Contains(utils.AnyToString(userId), "s") {
isShare = 1
}
split := strings.Split(utils.AnyToString(userId), "_")
if len(split) < 3 {
return
}
mid := split[2]
puid := ""
if len(split) == 4 {
puid = split[2]
}
uid := split[1]
title := ""
img := ""
if len(order.ProductList) > 0 {
title = order.ProductList[0].Name
img = order.ProductList[0].Img
}
var ord = &model.GuideOrder{
Oid: utils.StrToInt64(utils.OrderUUID(utils.StrToInt(uid))),
Uid: utils.StrToInt(mid),
ExtendUid: utils.StrToInt(puid),
StationUid: utils.StrToInt(uid),
PvdOid: order.OrderId,
PvdParentOid: order.RootOrderId,
Status: statusArr[order.Status],
CreateTime: order.PayTime,
UpdateTime: int(time.Now().Unix()),
Commission: utils.Float64ToStr(float64(order.CommissionAmount) / 100),
Title: title,
Payment: utils.Float64ToStr(float64(order.PayAmount) / 100),
Pvd: "tikTok_life",
Img: img,
IsShare: isShare,
}

if order.SettleFinish || order.Status != 2 {
var amount int64 = 0
isEnd := 1
var endTime int64 = 0
settleOrders, ok := order.SettleOrders.([]interface{})
if ok {
for _, v := range settleOrders {
tmp, ok := v.(map[string]interface{})
if ok == false || utils.AnyToInt64(tmp["status"]) < 3 {
isEnd = 0
}
if ok && utils.AnyToInt64(tmp["status"]) == 3 {
endTime = utils.AnyToInt64(tmp["settle_time"])
amount += utils.AnyToInt64(tmp["settle_amount"])
}
}
}
if ok == false || len(settleOrders) == 0 {
isEnd = 0
}
if isEnd == 1 {
ord.Status = "订单结算"
if order.Status == 5 {
ord.Status = "部分结算"
}
ord.PlatformSettleTime = int(endTime)
if ord.PlatformSettleTime == 0 {
ord.PlatformSettleTime = ord.UpdateTime
}
ord.RealCommission = utils.Float64ToStr(float64(amount) / 100)
}
}
one := db.GetGuideOrderByOne(ord.PvdOid, utils.IntToStr(ord.Uid), ord.Pvd)
if one == nil {
insertOne, err := db.ZhimengDb.InsertOne(ord)
fmt.Println(insertOne)
fmt.Println(err)
} else {
ord.SettleTime = one.SettleTime
if one.PlatformSettleTime > 0 {
ord.PlatformSettleTime = one.PlatformSettleTime
}
db.ZhimengDb.Where("id=?", one.Id).AllCols().Update(ord)
}
return
}

+ 21
- 0
app/task/task_csjp_life_order.go Dosyayı Görüntüle

@@ -0,0 +1,21 @@
package task

import (
"applet/app/task/svc"
"math/rand"
"time"
)

func taskCsjpLocalLifeOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.CsjpLocalLifeOrder()
<-ch
}

+ 1
- 1
go.mod Dosyayı Görüntüle

@@ -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.20240701084733-e197a1ca8795
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240703022510-030b67bd5fdb
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


Yükleniyor…
İptal
Kaydet