From 6e21a6ee23023ccb2cd598bd8ce24fe62f6f15c4 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 11 Dec 2023 19:20:49 +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/hdl/hdl_file_upload.go | 121 +++++++++++-------- app/task/svc/svc_tik_tok_local_life_order.go | 2 +- app/task/svc/svc_tik_tok_task_money.go | 3 + go.mod | 2 + 4 files changed, 78 insertions(+), 50 deletions(-) diff --git a/app/hdl/hdl_file_upload.go b/app/hdl/hdl_file_upload.go index c498110..d4fe880 100644 --- a/app/hdl/hdl_file_upload.go +++ b/app/hdl/hdl_file_upload.go @@ -60,7 +60,6 @@ func ImgReqUpload(c *gin.Context) { e.OutSuc(c, my1, nil) } - func File(c *gin.Context) { rFile, _ := c.FormFile("file") file, err := rFile.Open() @@ -79,7 +78,7 @@ func File(c *gin.Context) { c.String(400, err.Error()) return } - if line[0] == "上架时间" { + if i == 0 { i++ continue } @@ -88,10 +87,19 @@ func File(c *gin.Context) { t := time.Now() var tmp md.TpdarenNew material := "" - if strings.Contains(line[4], " 提取码") == false { - material = line[4] + tqm := line[6] + Description := line[7] + Episode := line[11] + Cate := line[8] + ImageUrl := line[14] + PayEpisode := line[12] + OnlineTime := line[0] + Title := line[4] + Id := line[3] + if strings.Contains(tqm, " 提取码") == false { + material = tqm } else { - ex := strings.Split(line[4], " 提取码: ") + ex := strings.Split(tqm, " 提取码: ") material = ex[0] if strings.Contains(material, "?pwd=") == false { material += "?pwd=" + ex[1] @@ -101,35 +109,42 @@ func File(c *gin.Context) { material = strings.ReplaceAll(material, "链接:", "") material = strings.ReplaceAll(material, " ", "") tmp = md.TpdarenNew{ - Description: line[5], - Episode: utils.StrToInt(line[9]), - Cate: line[6], - ImageUrl: line[12], + Description: Description, + Episode: utils.StrToInt(Episode), + Cate: Cate, + ImageUrl: ImageUrl, IsEnd: 0, - PayEpisode: utils.StrToInt(line[10]), + PayEpisode: utils.StrToInt(PayEpisode), Material: material, - OnlineTime: time.Date(t.Year(), time.Month(utils.StrToInt(strings.ReplaceAll(line[0], "月", ""))), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"), + OnlineTime: time.Date(t.Year(), time.Month(utils.StrToInt(strings.ReplaceAll(OnlineTime, "月", ""))), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"), Type: "dianzhong", - Title: line[2], + Title: Title, Data: utils.SerializeStr(line), DouyinTheaterId: 1, KuaishouTheaterId: 2, UpdateTime: int(time.Now().Unix()) - i*10, - Time: int(time.Date(t.Year(), time.Month(utils.StrToInt(strings.ReplaceAll(line[0], "月", ""))), 1, 0, 0, 0, 0, t.Location()).Unix()), + Time: int(time.Date(t.Year(), time.Month(utils.StrToInt(strings.ReplaceAll(OnlineTime, "月", ""))), 1, 0, 0, 0, 0, t.Location()).Unix()), Appid: "31517", - Id: line[1], + Id: Id, IsClose: 0, } i++ + fmt.Println(tmp) var uniqueId = "" - tmp.VideoType = "douyin" - uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) - commAdd(uniqueId, tmp) + if utils.InArr(line[1], []string{"快手下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用"}) == false { + tmp.VideoType = "kuaishou" + uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + fmt.Println(uniqueId) + commAdd(uniqueId, tmp) + } + if utils.InArr(line[1], []string{"抖音下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) == false { - tmp.VideoType = "kuaishou" - uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) - commAdd(uniqueId, tmp) + tmp.VideoType = "douyin" + uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + fmt.Println(uniqueId) + commAdd(uniqueId, tmp) + } } } @@ -195,17 +210,19 @@ func FileTwo(c *gin.Context) { } var uniqueId = "" - if utils.InArr(line[4], []string{"上架", "微信小程序下架", "乔陌漓,颜汐落"}) { - - tmp.VideoType = "douyin" - uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) - commAdd(uniqueId, tmp) + if utils.InArr(line[4], []string{"上架", "微信小程序下架", "乔陌漓,颜汐落"}) == false { + tmp.IsClose = 1 } - if utils.InArr(line[4], []string{"上架", "微信小程序下架", "乔陌漓,颜汐落", "抖音下架", "抖音下架、其他媒体上架"}) { - tmp.VideoType = "kuaishou" - uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) - commAdd(uniqueId, tmp) + tmp.VideoType = "douyin" + uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + commAdd(uniqueId, tmp) + tmp.IsClose = 0 + if utils.InArr(line[4], []string{"上架", "微信小程序下架", "乔陌漓,颜汐落", "抖音下架", "抖音下架、其他媒体上架"}) == false { + tmp.IsClose = 1 } + tmp.VideoType = "kuaishou" + uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + commAdd(uniqueId, tmp) } } @@ -221,7 +238,7 @@ func FileSecond(c *gin.Context) { defer file.Close() reader := csv.NewReader(bufio.NewReader(file)) i := 0 - day := 10 + day := 12 for { line, err := reader.Read() @@ -229,10 +246,7 @@ func FileSecond(c *gin.Context) { c.String(400, err.Error()) return } - if len(line) < 4 { - continue - } - if line[3] == "剧集ID" || line[3] == "" { + if i == 0 { i++ continue } @@ -241,10 +255,18 @@ func FileSecond(c *gin.Context) { t := time.Now() var tmp md.TpdarenNew material := "" - if strings.Contains(line[6], " 提取码") == false { - material = line[6] + tqm := line[7] + Description := line[8] + Episode := line[11] + Cate := line[9] + ImageUrl := line[14] + PayEpisode := line[12] + Title := line[4] + Id := line[3] + if strings.Contains(tqm, " 提取码") == false { + material = tqm } else { - ex := strings.Split(line[6], " 提取码") + ex := strings.Split(tqm, " 提取码") material = ex[0] if strings.Contains(material, "?pwd=") == false { material += "?pwd=" + ex[1] @@ -253,34 +275,35 @@ func FileSecond(c *gin.Context) { material = strings.ReplaceAll(material, "链接:", "") tmp = md.TpdarenNew{ - Description: line[7], - Episode: utils.StrToInt(line[11]), - Cate: line[8], - ImageUrl: line[14], + Description: Description, + Episode: utils.StrToInt(Episode), + Cate: Cate, + ImageUrl: ImageUrl, IsEnd: 0, - PayEpisode: utils.StrToInt(line[12]), + PayEpisode: utils.StrToInt(PayEpisode), Material: material, OnlineTime: time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"), Type: "dianzhong", - Title: line[4], + Title: Title, Data: utils.SerializeStr(line), DouyinTheaterId: 1, KuaishouTheaterId: 2, UpdateTime: int(time.Now().Unix()) - i*10, Time: int(time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Unix()), Appid: "31517", - Id: line[3], + Id: Id, IsClose: 0, } i++ var uniqueId = "" - - tmp.VideoType = "douyin" + tmp.VideoType = "kuaishou" uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + fmt.Println(uniqueId) commAdd(uniqueId, tmp) - tmp.VideoType = "kuaishou" + tmp.VideoType = "douyin" uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) + fmt.Println(uniqueId) commAdd(uniqueId, tmp) } @@ -317,13 +340,13 @@ func FileDown(c *gin.Context) { i++ var uniqueId = "" - if utils.InArr(line[3], []string{"快手下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用"}) { + if utils.InArr(line[3], []string{"快手下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用"}) { tmp.VideoType = "kuaishou" uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) fmt.Println(uniqueId) commDown(uniqueId, tmp) } - if utils.InArr(line[3], []string{"抖音下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) { + if utils.InArr(line[3], []string{"抖音下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) { tmp.VideoType = "douyin" uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) diff --git a/app/task/svc/svc_tik_tok_local_life_order.go b/app/task/svc/svc_tik_tok_local_life_order.go index 75741e1..99d4697 100644 --- a/app/task/svc/svc_tik_tok_local_life_order.go +++ b/app/task/svc/svc_tik_tok_local_life_order.go @@ -63,7 +63,7 @@ func GetTikTokLocalLifeOrder(p string, uid string) (int, string, bool) { tikTokOpenUid := offical.MasterListCfgGetOneData(uid, "tik_tok_open_uid") endTime := time.Now().Unix() - startTime := endTime - 300 + startTime := endTime - 86400 param := map[string]interface{}{ "uid": tikTokOpenUid, "cursor": p, diff --git a/app/task/svc/svc_tik_tok_task_money.go b/app/task/svc/svc_tik_tok_task_money.go index b8f5a92..7246e17 100644 --- a/app/task/svc/svc_tik_tok_task_money.go +++ b/app/task/svc/svc_tik_tok_task_money.go @@ -105,6 +105,9 @@ func TikTokTaskMoney(types string) { if tikTokData.Id == 0 || tikTokData.Ext == "" { continue } + if commission < 0 { + commission = 0 + } split := strings.Split(tikTokData.Ext, "_") var tmp = model.PlayletSaleOrder{ Uid: split[0], diff --git a/go.mod b/go.mod index a5c1bcc..153af65 100644 --- a/go.mod +++ b/go.mod @@ -26,10 +26,12 @@ require ( github.com/qiniu/api.v7/v7 v7.8.2 github.com/robfig/cron/v3 v3.0.1 github.com/sony/sonyflake v1.1.0 + github.com/stretchr/testify v1.8.0 // indirect github.com/syyongx/php2go v0.9.7 github.com/tidwall/gjson v1.14.1 go.uber.org/zap v1.16.0 golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect + golang.org/x/net v0.14.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/yaml.v2 v2.4.0 xorm.io/xorm v1.3.2