From d39e7ad16391e7b3e99e16d6de4b528b7ef95955 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 23 Feb 2024 10:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/task/md/md_tik_tok_task.go | 30 ++++++++- app/task/svc/svc_tik_tok_task.go | 86 +++++++++++++------------- app/task/svc/svc_tik_tok_task_money.go | 5 +- 3 files changed, 74 insertions(+), 47 deletions(-) diff --git a/app/task/md/md_tik_tok_task.go b/app/task/md/md_tik_tok_task.go index 388bf6f..9e58e75 100644 --- a/app/task/md/md_tik_tok_task.go +++ b/app/task/md/md_tik_tok_task.go @@ -1,7 +1,33 @@ package md -var SourceCate = map[string]string{"tt99fdef4006c36ff001": "dianzhong", "tt38e94e54a7d70c4601": "bihai", "ttd02aa6974f166cca01": "bihai", "tt8a93fc2e15affaaa01": "beiwo"} -var SourceBili = map[string]string{"tt99fdef4006c36ff001": "15", "tt38e94e54a7d70c4601": "20", "ttd02aa6974f166cca01": "20", "tt8a93fc2e15affaaa01": "20"} +var SourceCate = map[string]string{ + "tt99fdef4006c36ff001": "dianzhong", + "tt38e94e54a7d70c4601": "bihai", + "ttd02aa6974f166cca01": "bihai", + "tt8a93fc2e15affaaa01": "beiwo", + "tt87bdf1001882dd4b01": "lutang", //鹿糖故事会 + "ttdc8aaa3743b4853f01": "xinghe", //星河剧场 +} +var SourceBili = map[string]string{ + "tt99fdef4006c36ff001": "15", + "tt38e94e54a7d70c4601": "20", + "ttd02aa6974f166cca01": "20", + "tt8a93fc2e15affaaa01": "20", + "tt87bdf1001882dd4b01": "20", + "ttdc8aaa3743b4853f01": "20", +} +var TaskAddList = []map[string]string{ + { + "name": "tt87bdf1001882dd4b01", + "type": "story", + "second_type": "lutang", + }, + { + "name": "ttdc8aaa3743b4853f01", + "type": "video", + "second_type": "xinghe", + }, +} type TikTokTaskDetail struct { AnchorTitle string `json:"anchor_title"` diff --git a/app/task/svc/svc_tik_tok_task.go b/app/task/svc/svc_tik_tok_task.go index fec79e6..92925ff 100644 --- a/app/task/svc/svc_tik_tok_task.go +++ b/app/task/svc/svc_tik_tok_task.go @@ -13,6 +13,7 @@ import ( "encoding/json" "fmt" "github.com/jinzhu/copier" + "github.com/syyongx/php2go" "github.com/tidwall/gjson" "strings" "time" @@ -78,54 +79,53 @@ func GetTaskDetail(appId string, tmp []int64) { tmpIn.ReferMaCaptures = utils.SerializeStr(v1.ReferMaCaptures) tmpIn.TaskTags = utils.SerializeStr(v1.TaskTags) tmpIn.ReferVideoCaptures = utils.SerializeStr(v1.ReferVideoCaptures) + + videoTmpStr := "bookId=" if tmpIn.Appid == "tt38e94e54a7d70c4601" { - ex := strings.Split(tmpIn.StartPage, "cid=") - if len(ex) > 1 { - exSecond := strings.Split(ex[1], "&") - tmpIn.VideoId = exSecond[0] - } - if tmpIn.VideoId == "" { - fmt.Println("失败", tmpIn) - continue - } - } else { - ex := strings.Split(tmpIn.StartPage, "bookId=") - if len(ex) > 1 { - exSecond := strings.Split(ex[1], "&") - tmpIn.VideoId = exSecond[0] - } - if tmpIn.VideoId == "" { - fmt.Println("失败", tmpIn) - continue - } + videoTmpStr = "cid=" + } else if strings.Contains(tmpIn.StartPage, "novelid=") { + videoTmpStr = "novelid=" + } else if strings.Contains(tmpIn.StartPage, "video_id=") { + videoTmpStr = "video_id=" + } + ex := strings.Split(tmpIn.StartPage, videoTmpStr) + if len(ex) > 1 { + exSecond := strings.Split(ex[1], "&") + tmpIn.VideoId = exSecond[0] + } + if tmpIn.VideoId == "" { + fmt.Println("失败", tmpIn) + continue } if tmpIn.Status != 2 { tmpIn.TaskEndTime = int(time.Now().Unix() - 10) } - if tmpIn.Appid == "tt8a93fc2e15affaaa01" { - //tmp2 := md.Cinema5bmsData{ - // Description: "", - // ImageUrl: tmpIn.TaskIcon, - // Material: "", - // OnlineTime: time.Unix(int64(tmpIn.TaskStartTime), 0).Format("2006-01-02 15:04:05"), - // Type: "fenghuang", - // Title: tmpIn.TaskName, - // UpdateTime: int(time.Now().Unix()), - // Time: tmpIn.TaskStartTime, - // Appid: "tt8a93fc2e15affaaa01", - // Id: utils.StrToInt(tmpIn.VideoId), - // IsClose: 0, - // IsHot: 0, - // FirstCate: "story", - // SecondCate: "", - // Platform: "tikTok", - //} - //if tmpIn.TaskEndTime < int(time.Now().Unix()) { - // tmp2.IsClose = 1 - //} - //uniqueId := php2go.Md5(tmp2.Appid + "_" + tmp2.Type + "_" + tmp2.FirstCate + "_" + utils.IntToStr(tmp2.Id)) - //fmt.Println(uniqueId) - //commAddNew(uniqueId, tmp2) + for _, v2 := range md.TaskAddList { + if tmpIn.Appid == v2["name"] { // + tmp2 := md.Cinema5bmsData{ + Description: "", + ImageUrl: tmpIn.TaskIcon, + Material: "", + OnlineTime: time.Unix(int64(tmpIn.TaskStartTime), 0).Format("2006-01-02 15:04:05"), + Type: v2["second_type"], + Title: tmpIn.TaskName, + UpdateTime: int(time.Now().Unix()), + Time: tmpIn.TaskStartTime, + Appid: v2["name"], + Id: utils.StrToInt(tmpIn.VideoId), + IsClose: 0, + IsHot: 0, + FirstCate: v2["type"], + SecondCate: "", + Platform: "tikTok", + } + if tmpIn.TaskEndTime < int(time.Now().Unix()) { + tmp2.IsClose = 1 + } + uniqueId := php2go.Md5(tmp2.Appid + "_" + tmp2.Type + "_" + tmp2.FirstCate + "_" + utils.IntToStr(tmp2.Id)) + fmt.Println(uniqueId) + commAddNew(uniqueId, tmp2) + } } CommAddTaskDetail(utils.Int64ToStr(tmpIn.TaskId), tmpIn) } diff --git a/app/task/svc/svc_tik_tok_task_money.go b/app/task/svc/svc_tik_tok_task_money.go index 8319ea7..7c1fe38 100644 --- a/app/task/svc/svc_tik_tok_task_money.go +++ b/app/task/svc/svc_tik_tok_task_money.go @@ -134,7 +134,7 @@ func TikTokTaskMoney(types string) { PlatformFee: utils.Float64ToStr(fee), TikFee: utils.Float64ToStr(talentBili), } - if utils.InArr(appId, []string{"ttd02aa6974f166cca01", "tt8a93fc2e15affaaa01"}) { + if utils.InArr(appId, []string{"ttd02aa6974f166cca01", "tt8a93fc2e15affaaa01", "tt87bdf1001882dd4b01"}) { tmp.OrdType = "story" } playletSaleOrderDb := db.PlayletSaleOrderDb{} @@ -142,7 +142,8 @@ func TikTokTaskMoney(types string) { ord := playletSaleOrderDb.GetPlayletVideoOrderByOid(tmp.Oid, tmp.OrdType) tmp.Status = "订单付款" if ord != nil { - if ord.CustomOid == "" { + tmp.CustomOid = ord.CustomOid + if ord.CustomOid == "" || ord.CustomOid == "0" { tmp.CustomOid = utils.OrderUUID(tmp.SubUid) } playletSaleOrderDb.PlayletVideoOrderUpdate(ord.Id, &tmp)