Browse Source

更新

master
huangjiajun 1 year ago
parent
commit
6e21a6ee23
4 changed files with 78 additions and 50 deletions
  1. +72
    -49
      app/hdl/hdl_file_upload.go
  2. +1
    -1
      app/task/svc/svc_tik_tok_local_life_order.go
  3. +3
    -0
      app/task/svc/svc_tik_tok_task_money.go
  4. +2
    -0
      go.mod

+ 72
- 49
app/hdl/hdl_file_upload.go View File

@@ -60,7 +60,6 @@ func ImgReqUpload(c *gin.Context) {
e.OutSuc(c, my1, nil) e.OutSuc(c, my1, nil)


} }

func File(c *gin.Context) { func File(c *gin.Context) {
rFile, _ := c.FormFile("file") rFile, _ := c.FormFile("file")
file, err := rFile.Open() file, err := rFile.Open()
@@ -79,7 +78,7 @@ func File(c *gin.Context) {
c.String(400, err.Error()) c.String(400, err.Error())
return return
} }
if line[0] == "上架时间" {
if i == 0 {
i++ i++
continue continue
} }
@@ -88,10 +87,19 @@ func File(c *gin.Context) {
t := time.Now() t := time.Now()
var tmp md.TpdarenNew var tmp md.TpdarenNew
material := "" 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 { } else {
ex := strings.Split(line[4], " 提取码: ")
ex := strings.Split(tqm, " 提取码: ")
material = ex[0] material = ex[0]
if strings.Contains(material, "?pwd=") == false { if strings.Contains(material, "?pwd=") == false {
material += "?pwd=" + ex[1] material += "?pwd=" + ex[1]
@@ -101,35 +109,42 @@ func File(c *gin.Context) {
material = strings.ReplaceAll(material, "链接:", "") material = strings.ReplaceAll(material, "链接:", "")
material = strings.ReplaceAll(material, " ", "") material = strings.ReplaceAll(material, " ", "")
tmp = md.TpdarenNew{ 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, IsEnd: 0,
PayEpisode: utils.StrToInt(line[10]),
PayEpisode: utils.StrToInt(PayEpisode),
Material: material, 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", Type: "dianzhong",
Title: line[2],
Title: Title,
Data: utils.SerializeStr(line), Data: utils.SerializeStr(line),
DouyinTheaterId: 1, DouyinTheaterId: 1,
KuaishouTheaterId: 2, KuaishouTheaterId: 2,
UpdateTime: int(time.Now().Unix()) - i*10, 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", Appid: "31517",
Id: line[1],
Id: Id,
IsClose: 0, IsClose: 0,
} }


i++ i++
fmt.Println(tmp)
var uniqueId = "" 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 = "" 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() defer file.Close()
reader := csv.NewReader(bufio.NewReader(file)) reader := csv.NewReader(bufio.NewReader(file))
i := 0 i := 0
day := 10
day := 12
for { for {


line, err := reader.Read() line, err := reader.Read()
@@ -229,10 +246,7 @@ func FileSecond(c *gin.Context) {
c.String(400, err.Error()) c.String(400, err.Error())
return return
} }
if len(line) < 4 {
continue
}
if line[3] == "剧集ID" || line[3] == "" {
if i == 0 {
i++ i++
continue continue
} }
@@ -241,10 +255,18 @@ func FileSecond(c *gin.Context) {
t := time.Now() t := time.Now()
var tmp md.TpdarenNew var tmp md.TpdarenNew
material := "" 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 { } else {
ex := strings.Split(line[6], " 提取码")
ex := strings.Split(tqm, " 提取码")
material = ex[0] material = ex[0]
if strings.Contains(material, "?pwd=") == false { if strings.Contains(material, "?pwd=") == false {
material += "?pwd=" + ex[1] material += "?pwd=" + ex[1]
@@ -253,34 +275,35 @@ func FileSecond(c *gin.Context) {
material = strings.ReplaceAll(material, "链接:", "") material = strings.ReplaceAll(material, "链接:", "")


tmp = md.TpdarenNew{ 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, IsEnd: 0,
PayEpisode: utils.StrToInt(line[12]),
PayEpisode: utils.StrToInt(PayEpisode),
Material: material, Material: material,
OnlineTime: time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"), OnlineTime: time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"),
Type: "dianzhong", Type: "dianzhong",
Title: line[4],
Title: Title,
Data: utils.SerializeStr(line), Data: utils.SerializeStr(line),
DouyinTheaterId: 1, DouyinTheaterId: 1,
KuaishouTheaterId: 2, KuaishouTheaterId: 2,
UpdateTime: int(time.Now().Unix()) - i*10, UpdateTime: int(time.Now().Unix()) - i*10,
Time: int(time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Unix()), Time: int(time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Unix()),
Appid: "31517", Appid: "31517",
Id: line[3],
Id: Id,
IsClose: 0, IsClose: 0,
} }
i++ i++
var uniqueId = "" var uniqueId = ""

tmp.VideoType = "douyin"
tmp.VideoType = "kuaishou"
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id)
fmt.Println(uniqueId)
commAdd(uniqueId, tmp) commAdd(uniqueId, tmp)


tmp.VideoType = "kuaishou"
tmp.VideoType = "douyin"
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id)
fmt.Println(uniqueId)
commAdd(uniqueId, tmp) commAdd(uniqueId, tmp)
} }


@@ -317,13 +340,13 @@ func FileDown(c *gin.Context) {


i++ i++
var uniqueId = "" var uniqueId = ""
if utils.InArr(line[3], []string{"快手下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用"}) {
if utils.InArr(line[3], []string{"快手下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用"}) {
tmp.VideoType = "kuaishou" tmp.VideoType = "kuaishou"
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id)
fmt.Println(uniqueId) fmt.Println(uniqueId)
commDown(uniqueId, tmp) commDown(uniqueId, tmp)
} }
if utils.InArr(line[3], []string{"抖音下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) {
if utils.InArr(line[3], []string{"抖音下架", "版权到期", "全媒体下架", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) {


tmp.VideoType = "douyin" tmp.VideoType = "douyin"
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id)


+ 1
- 1
app/task/svc/svc_tik_tok_local_life_order.go View File

@@ -63,7 +63,7 @@ func GetTikTokLocalLifeOrder(p string, uid string) (int, string, bool) {
tikTokOpenUid := offical.MasterListCfgGetOneData(uid, "tik_tok_open_uid") tikTokOpenUid := offical.MasterListCfgGetOneData(uid, "tik_tok_open_uid")


endTime := time.Now().Unix() endTime := time.Now().Unix()
startTime := endTime - 300
startTime := endTime - 86400
param := map[string]interface{}{ param := map[string]interface{}{
"uid": tikTokOpenUid, "uid": tikTokOpenUid,
"cursor": p, "cursor": p,


+ 3
- 0
app/task/svc/svc_tik_tok_task_money.go View File

@@ -105,6 +105,9 @@ func TikTokTaskMoney(types string) {
if tikTokData.Id == 0 || tikTokData.Ext == "" { if tikTokData.Id == 0 || tikTokData.Ext == "" {
continue continue
} }
if commission < 0 {
commission = 0
}
split := strings.Split(tikTokData.Ext, "_") split := strings.Split(tikTokData.Ext, "_")
var tmp = model.PlayletSaleOrder{ var tmp = model.PlayletSaleOrder{
Uid: split[0], Uid: split[0],


+ 2
- 0
go.mod View File

@@ -26,10 +26,12 @@ require (
github.com/qiniu/api.v7/v7 v7.8.2 github.com/qiniu/api.v7/v7 v7.8.2
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/sony/sonyflake v1.1.0 github.com/sony/sonyflake v1.1.0
github.com/stretchr/testify v1.8.0 // indirect
github.com/syyongx/php2go v0.9.7 github.com/syyongx/php2go v0.9.7
github.com/tidwall/gjson v1.14.1 github.com/tidwall/gjson v1.14.1
go.uber.org/zap v1.16.0 go.uber.org/zap v1.16.0
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect 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/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
xorm.io/xorm v1.3.2 xorm.io/xorm v1.3.2


Loading…
Cancel
Save