ソースを参照

更新

master
huangjiajun 5ヶ月前
コミット
c556779898
13個のファイルの変更281行の追加2行の削除
  1. +1
    -0
      app/db/model/guide_order.go
  2. +1
    -1
      app/hdl/hdl_file_upload.go
  3. +1
    -0
      app/hdl/zhimeng_platform/hdl_guide_order_list.go
  4. +27
    -0
      app/md/meituan.go
  5. +2
    -0
      app/svc/platform/svc_guide_order_list.go
  6. +1
    -0
      app/task/init.go
  7. +1
    -0
      app/task/md/cron_key.go
  8. +6
    -0
      app/task/svc/svc_kuaishou_order.go
  9. +209
    -0
      app/task/svc/svc_meituan_order.go
  10. +1
    -0
      app/task/svc/svc_tik_tok_local_life_order_settle.go
  11. +9
    -0
      app/task/svc/svc_tik_tok_task.go
  12. +21
    -0
      app/task/task_meituan_order.go
  13. +1
    -1
      go.mod

+ 1
- 0
app/db/model/guide_order.go ファイルの表示

@@ -23,4 +23,5 @@ type GuideOrder struct {
Ext string `json:"ext" xorm:"VARCHAR(3000)"`
Gid string `json:"gid" xorm:"VARCHAR(255)"`
TeamType string `json:"team_type" xorm:"VARCHAR(255)"`
TaskType string `json:"task_type" xorm:"VARCHAR(255)"`
}

+ 1
- 1
app/hdl/hdl_file_upload.go
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 1
- 0
app/hdl/zhimeng_platform/hdl_guide_order_list.go ファイルの表示

@@ -19,6 +19,7 @@ func GuideOrderList(c *gin.Context) {
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
}

data, total := platform.GuideOrderList(c, args)


+ 27
- 0
app/md/meituan.go ファイルの表示

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

type MeituanOrder struct {
BusinessLine int `json:"businessLine"`
OrderId string `json:"orderId"`
PayTime int `json:"payTime"`
PayPrice string `json:"payPrice"`
UpdateTime int `json:"updateTime"`
CommissionRate string `json:"commissionRate"`
Profit string `json:"profit"`
CpaProfit string `json:"cpaProfit"`
Sid string `json:"sid"`
ProductId string `json:"productId"`
ProductName string `json:"productName"`
OrderDetail interface{} `json:"orderDetail"`
RefundPrice interface{} `json:"refundPrice"`
RefundTime string `json:"refundTime"`
RefundProfit string `json:"refundProfit"`
CpaRefundProfit string `json:"cpaRefundProfit"`
Status string `json:"status"`
TradeType int `json:"tradeType"`
ActId int `json:"actId"`
Appkey string `json:"appkey"`
SkuCount interface{} `json:"skuCount"`
Platform int `json:"platform"`
CityName interface{} `json:"cityName"`
}

+ 2
- 0
app/svc/platform/svc_guide_order_list.go ファイルの表示

@@ -18,6 +18,7 @@ func GuideOrderList(c *gin.Context, args map[string]string) ([]map[string]string
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
}
if len(list) > 0 {
for _, v := range list {
@@ -79,6 +80,7 @@ func GuideOrderOutput(c *gin.Context, args map[string]string) (string, map[strin
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
}

list, _ := db.GetGuideOrderListTotal(args)


+ 1
- 0
app/task/init.go ファイルの表示

@@ -118,5 +118,6 @@ func initTasks() {
jobs[taskMd.ZhimengCronTikTokLocalLifeOrderSettle] = taskTikTokLocalLifeOrderSettle //
jobs[taskMd.ZhimengCronKuaishouOrder] = taskKuaishouOrder //
jobs[taskMd.ZhimengCronKuaishouAuth] = taskKuaishouAuth //
jobs[taskMd.ZhimengCronMeituanOrder] = taskMeituanOrder //

}

+ 1
- 0
app/task/md/cron_key.go ファイルの表示

@@ -40,6 +40,7 @@ const (
ZhimengCronHwDeliveryOrder = "zhimeng_cron_hw_delivery_order"
ZhimengCronHwTourismOrder = "zhimeng_cron_hw_tourism_order"
ZhimengCronKuaishouOrder = "zhimeng_cron_kuaishou_order"
ZhimengCronMeituanOrder = "zhimeng_cron_meituan_order"
ZhimengCronKuaishouAuth = "zhimeng_cron_kuaishou_auth"
ZhimengCronTikTokLocalLifeOrder = "zhimeng_cron_tik_tok_local_life_order"
ZhimengCronTikTokLocalLifeOrderSettle = "zhimeng_cron_tik_tok_local_life_order_settle"


+ 6
- 0
app/task/svc/svc_kuaishou_order.go ファイルの表示

@@ -171,6 +171,12 @@ func OrdersKuaishouGet(nextPositionIndex string, pageSize int, sTime, eTime int6
if ex[0] == "moref" {
orderType = 13
}
taskType := ""
if utils.InArr(ex[0], []string{"happy_orchard"}) {
orderType = 1
taskType = ex[0]
}
resNew.TaskType = taskType
resNew.Oid = utils.StrToInt64(utils.OrderUUID(utils.StrToInt(ex[1])))
resNew.PvdOid = utils.IntToStr(v1.Oid)
resNew.Uid = utils.StrToInt(ex[2])


+ 209
- 0
app/task/svc/svc_meituan_order.go ファイルの表示

@@ -0,0 +1,209 @@
package svc

import (
"applet/app/db"
"applet/app/db/model"
offical "applet/app/db/official"
md2 "applet/app/md"
"applet/app/utils"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/meituan_cps"
"encoding/json"
"fmt"
"github.com/tidwall/gjson"
"strings"
"time"
)

func MeituanOrder() {
pvdTimeKey := "meituan_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
nextPositionIndex string = ""
)

//怕时间不是走最新的
leave := now - past
if leave > 500 {
leave = 0
}
past = past + leave
beginTime = past - 300
endTime = past

if endTime > now {
endTime = now
}

for {
count := 0
var positionIndex = ""
if pageNo == 1 {
nextPositionIndex = ""
}
count, positionIndex = OrdersMeituanGet(nextPositionIndex, pageSize, beginTime, endTime, "update", 0)
if count == 0 {
nextPositionIndex = ""
goto ChkArg
}
// 判断是否分页已经全部取完了
if count <= pageSize {
nextPositionIndex = positionIndex
pageNo++
fmt.Println("========下一页========" + utils.IntToStr(pageNo))
count = 0
continue
}
ChkArg:
nextPositionIndex = ""

// 查询完后重置时间, 最后查询时间
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
}
}

func OrdersMeituanGet(nextPositionIndex string, pageSize int, sTime, eTime int64, timeType string, pvd int) (int, string) {
key := offical.SysCfgByKeyStr("meituan_cps_key")
secret := offical.SysCfgByKeyStr("meituan_cps_secret")
arg := map[string]interface{}{
"queryTimeType": 2, // 1 按订单支付时间查询, 2 按照更新时间查询, 默认为1
"page": 1, //页码,默认1,从1开始,若searchType选择2,本字段必须传1,若不传参数默认1
"searchType": 2, //订单分页查询方案选择,不填则默认为1。1 分页查询(最多能查询到1万条订单),当选择本查询方案,page参数不能为空。此查询方式后续不再维护,建议使用2逐页查询。2 逐页查询(不限制查询订单数,只能逐页查询,不能指定页数),当选择本查询方案,需配合scrollId参数使用
"startTime": sTime, //
"endTime": eTime, //
"limit": pageSize,
"scrollId": nextPositionIndex,
}
method1 := "query_order"
send, err := meituan_cps.Send(method1, key, secret, arg)
goods := gjson.Get(send, "data.dataList").String()
newPcursor := gjson.Get(send, "data.scrollId").String()
if goods == "" || err != nil {
return 0, ""
}
var list = make([]md2.MeituanOrder, 0)
err = json.Unmarshal([]byte(goods), &list)
if err != nil {
return 0, ""
}
var meituanState = map[string]string{
"2": "订单付款",
"3": "订单完成",
"4": "订单失效",
"5": "风控",
"6": "订单结算",
}
for _, v := range list {
var res = model.GuideOrder{
PvdParentOid: v.OrderId,
Pvd: "meituan",
Status: meituanState[v.Status],
CreateTime: v.PayTime,
}
if v.PayTime == 0 {
res.CreateTime = int(time.Now().Unix())
}
if v.UpdateTime > 0 && v.Status == "6" {
res.PlatformSettleTime = v.UpdateTime
}
ex := strings.Split(v.Sid, "_")
if len(ex) < 3 {
continue
}
orderType := 0
if ex[0] == "share" {
orderType = 1
}
res.Uid = utils.StrToInt(ex[1])
res.StationUid = utils.StrToInt(ex[2])
orderDetail, ok := v.OrderDetail.([]interface{})
Profit := v.Profit
state := "1"
if ok {
if len(orderDetail) > 0 {
allEnd := "1"
for k1, v1 := range orderDetail {
v2, ok := v1.(map[string]interface{})
if ok {
if k1 == 0 {
state = utils.AnyToString(v2["couponStatus"])
}
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"}) {
allEnd = "0"
}
}
}
if allEnd == "0" {
res.Status = state
res.PlatformSettleTime = 0
}
}
}
res.Oid = utils.StrToInt64(utils.OrderUUID(utils.StrToInt(ex[1])))
res.PvdOid = v.OrderId
res.Uid = utils.StrToInt(ex[1])
res.StationUid = utils.StrToInt(ex[2])
res.UpdateTime = int(time.Now().Unix())
res.Commission = Profit
res.RealCommission = Profit
res.Title = v.ProductName
if v.ProductId == "null" {
v.ProductId = v.OrderId
}
res.Gid = v.ProductId
res.IsShare = orderType
res.Payment = v.PayPrice
one := db.GetGuideOrderByOne(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(list), newPcursor
}

+ 1
- 0
app/task/svc/svc_tik_tok_local_life_order_settle.go ファイルの表示

@@ -36,6 +36,7 @@ func TikTokLocalLifeOrderSettle() {
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
}
for _, v := range order {
fmt.Println("=================00")


+ 9
- 0
app/task/svc/svc_tik_tok_task.go ファイルの表示

@@ -65,6 +65,15 @@ func GetTaskDetail(appId string, tmp []int64) {
}
xinghes := map[string]string{

"7380190485731639322": "https://pan.baidu.com/s/1L8zOJCMdBIwdEvkLV2O4Nw?pwd=miof",
"7379912213080883200": "https://pan.baidu.com/s/1NBh7T8wsKg-qUv37lZh5Vg?pwd=qi55",
"7379861578981703695": "https://pan.baidu.com/s/1thjZIuLkMj2QUNEc3xLVFg?pwd=uvqo",
"7379784012149112872": "https://pan.baidu.com/s/1p9mCmmkrq0pDcNTSW0xtLg?pwd=aa57",
"7379784012149096488": "https://pan.baidu.com/s/1ZOINZXHrH_PnSwnEFRWN-Q?pwd=fz0g",
"7379804114810634276": "https://pan.baidu.com/s/1_RMKz-qqw96mqFN5N--zoQ?pwd=s9vb",
"7379461837433307173": "https://pan.baidu.com/s/1MTqjaO3oKt8KS-zTfXoG_Q?pwd=03l9",
"7379413447399784498": "https://pan.baidu.com/s/1JPuFx_a-AgDUMuotdoQhMg?pwd=9tch",
"7379413956869242906": "https://pan.baidu.com/s/1Z38OjOKTYaC6Eo4mePWlLg?pwd=qoo4",
"7379040298610999332": "https://pan.baidu.com/s/1Wq4GKZJk49WvKNvp55xMqA?pwd=9zal",
"7377925238903881754": "https://pan.baidu.com/s/1ZhHrU40YMITyRwh0_evn-g?pwd=i77m",
"7377636356299898931": "https://pan.baidu.com/s/1bUN8GLg27dHkAKY8Arn98w?pwd=9lo9",


+ 21
- 0
app/task/task_meituan_order.go ファイルの表示

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

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

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

+ 1
- 1
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.20240531095238-f42743eb0c52
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240628083932-3a853b9ed178
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


読み込み中…
キャンセル
保存