|
|
@@ -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"] != "" { |
|
|
|