Browse Source

更新

master
huangjiajun 10 months ago
parent
commit
88230a98ad
8 changed files with 170 additions and 22 deletions
  1. +80
    -6
      app/hdl/hdl_file_upload.go
  2. +2
    -0
      app/router/router.go
  3. +1
    -0
      app/task/init.go
  4. +1
    -0
      app/task/md/cron_key.go
  5. +1
    -1
      app/task/svc/svc_cinema5bms.go
  6. +5
    -2
      app/task/svc/svc_tik_tok_csjp.go
  7. +58
    -13
      app/task/svc/svc_tik_tok_task.go
  8. +22
    -0
      app/task/task_tik_tok_csjp_live.go

+ 80
- 6
app/hdl/hdl_file_upload.go
File diff suppressed because it is too large
View File


+ 2
- 0
app/router/router.go View File

@@ -65,6 +65,8 @@ func routeInternal(r *gin.RouterGroup) {
func routeZhimeng(r *gin.RouterGroup) {
r.GET("/test", hdl.Order)
r.GET("/cinema", hdl.Cinema)
r.GET("/task", hdl.TikTokTask)

r.POST("/bihai_file_new", hdl.BihaiFile)
r.GET("/bihai_add", hdl.BihaiAdd)
r.POST("/file_new", hdl.File)


+ 1
- 0
app/task/init.go View File

@@ -91,6 +91,7 @@ func initTasks() {

jobs[taskMd.ZhimengCronTikTokCsjp] = taskTikTokCsjp //
jobs[taskMd.ZhimengCronTikTokCsjpActivity] = taskTikTokCsjpActivity //
jobs[taskMd.ZhimengCronTikTokCsjpLive] = taskTikTokCsjpLive //

jobs[taskMd.ZhimengCronTikTokTask] = taskTikTokTask //
jobs[taskMd.ZhimengCronTikTokTaskRelate] = taskTikTokTaskRelate //


+ 1
- 0
app/task/md/cron_key.go View File

@@ -8,6 +8,7 @@ const (
ZhimengCronCinema5bmsOrder = "zhimeng_cron_cinema5bms_order"
ZhimengCronCinema5bmsYesterOrder = "zhimeng_cron_cinema5bms_yester_order"
ZhimengCronTikTokCsjpActivity = "zhimeng_cron_tik_tok_csjp_activity"
ZhimengCronTikTokCsjpLive = "zhimeng_cron_tik_tok_csjp_live"
ZhimengCronTikTokTask = "zhimeng_cron_tik_tok_task" //短剧订单
ZhimengCronTikTokTaskMoney = "zhimeng_cron_tik_tok_task_money" //短剧订单
ZhimengCronTikTokTaskMoneyByYestday = "zhimeng_cron_tik_tok_task_money_by_yestday"


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

@@ -63,7 +63,7 @@ func Cinema5bms() {
}
func commAddNew(uniqueId string, tmp md.Cinema5bmsData) {
doc, _ := es.FirstDoc(md2.ZhiosNewVideo, uniqueId)
if doc == nil {
if doc == nil && tmp.IsClose == 0 {
createDocRet, err := es.CreateDoc(md2.ZhiosNewVideo, uniqueId, tmp)
if err != nil {
return


+ 5
- 2
app/task/svc/svc_tik_tok_csjp.go View File

@@ -157,8 +157,11 @@ func OrdersTikTokGet(nextPositionIndex string, pageSize int, sTime, eTime int64,
if v["is_share"] == "6" {
orderType = 13
}

if v["type"] == "" {
v["type"] = "csjp"
}
var ord = &model.GuideOrder{
Oid: utils.StrToInt64(utils.OrderUUID(utils.StrToInt(v["uid"]))),
Uid: utils.StrToInt(v["mid"]),
StationUid: utils.StrToInt(v["uid"]),
PvdOid: utils.AnyToString(v["oid"]),
@@ -168,7 +171,7 @@ func OrdersTikTokGet(nextPositionIndex string, pageSize int, sTime, eTime int64,
Commission: v["commission"],
Title: utils.AnyToString(v["info"]),
Payment: v["payment"],
Pvd: "csjp",
Pvd: v["type"],
Img: v["product_img"],
IsShare: orderType,
Gid: v["product_id"],


+ 58
- 13
app/task/svc/svc_tik_tok_task.go View File

@@ -1,6 +1,7 @@
package svc

import (
"applet/app/cfg"
offical "applet/app/db/official"
md2 "applet/app/es/md"
"applet/app/task/md"
@@ -12,6 +13,7 @@ import (
"encoding/json"
"fmt"
"github.com/jinzhu/copier"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
"strings"
"time"
@@ -44,15 +46,15 @@ func TikTokTask() {
offical.MasterListCfgSave("0", "tik_tok_task_appid_time_"+v, utils.Int64ToStr(endTime))
continue
}
commAddTask("tik_tok_task_"+v, taskIds)
CommAddTask("tik_tok_task_"+v, taskIds)
var tmp = make([]int64, 0)
json.Unmarshal([]byte(taskIds), &tmp)
getTaskDetail(v, tmp)
GetTaskDetail(v, tmp)
fmt.Println(endTime)
offical.MasterListCfgSave("0", "tik_tok_task_appid_time_"+v, utils.Int64ToStr(endTime))
}
}
func getTaskDetail(appId string, tmp []int64) {
func GetTaskDetail(appId string, tmp []int64) {
for _, v := range tmp {
param := map[string]interface{}{
"appid": appId,
@@ -77,20 +79,60 @@ func getTaskDetail(appId string, tmp []int64) {
tmpIn.ReferMaCaptures = utils.SerializeStr(v1.ReferMaCaptures)
tmpIn.TaskTags = utils.SerializeStr(v1.TaskTags)
tmpIn.ReferVideoCaptures = utils.SerializeStr(v1.ReferVideoCaptures)
ex := strings.Split(tmpIn.StartPage, "bookId=")
if len(ex) > 1 {
exSecond := strings.Split(ex[1], "&")
tmpIn.VideoId = exSecond[0]
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
}
}
if tmpIn.VideoId == "" {
fmt.Println("失败", tmpIn)
continue
if tmpIn.Status != 2 {
tmpIn.TaskEndTime = int(time.Now().Unix() - 10)
}
commAddTaskDetail(utils.Int64ToStr(tmpIn.TaskId), tmpIn)
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)
}
CommAddTaskDetail(utils.Int64ToStr(tmpIn.TaskId), tmpIn)
}
}
}
func commAddTask(uniqueId string, taskIds string) {
func CommAddTask(uniqueId string, taskIds string) {
doc, _ := es.FirstDoc(md2.ZhiosTikTokTaskEsIndex, uniqueId)
if doc == nil {
var tmpData = map[string]string{
@@ -123,7 +165,7 @@ func commAddTask(uniqueId string, taskIds string) {
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet)
}
}
func commAddTaskDetail(uniqueId string, tmp md.TikTokTaskDetailSecond) {
func CommAddTaskDetail(uniqueId string, tmp md.TikTokTaskDetailSecond) {
doc, _ := es.FirstDoc(md2.ZhiosTikTokTaskDetailEsIndex, uniqueId)
if doc == nil {

@@ -150,6 +192,9 @@ func TikTokTaskToken() string {
}
key := "tikTok_client_" + args["appkey"]
tokeStr, err := cache.GetString(key)
if cfg.Prd == false {
return tokeStr
}
if tokeStr == "" || err != nil {
token := tik_tok.GetClientToken(args)
if token["tik_tok_acc_token"] != "" {


+ 22
- 0
app/task/task_tik_tok_csjp_live.go View File

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

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

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

Loading…
Cancel
Save