|
- package svc
-
- import (
- "applet/app/cfg"
- offical "applet/app/db/official"
- md2 "applet/app/es/md"
- md3 "applet/app/md"
- "applet/app/task/md"
- "applet/app/utils"
- "applet/app/utils/cache"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok"
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "encoding/json"
- "fmt"
- "github.com/jinzhu/copier"
- "github.com/syyongx/php2go"
- "github.com/tidwall/gjson"
- "strings"
- "time"
- )
-
- func TikTokTask() {
- //doc, _ := es.FirstDoc(md2.ZhiosTikTokTaskEsIndex, "tik_tok_task_tt99fdef4006c36ff001")
- //fmt.Println(string(doc.Source))
- //return
- //es.CreateIndexIfNotExists(md2.ZhiosTikTokTaskEsIndex, md2.ZhiosTikTokTaskEsMapping)
- //es.CreateIndexIfNotExists(md2.ZhiosTikTokTaskDetailEsIndex, md2.ZhiosTikTokTaskDetailEsMapping)
- appidList := offical.MasterListCfgGetOneData("0", "tik_tok_task_appid")
- split := strings.Split(appidList, ";")
- for _, v := range split {
- endTime := time.Now().Unix()
- startTime := endTime - 7*86400
- if endTime > time.Now().Unix() {
- endTime = time.Now().Unix()
- }
- param := map[string]interface{}{
- "appid": v,
- "create_start_time": startTime,
- "create_end_time": endTime,
- }
- api, _ := tik_tok.TaskApi("query_app_task_id/", TikTokTaskToken(), zhios_third_party_utils.SerializeStr(param))
- taskIds := gjson.Get(api, "data.task_ids").String()
- fmt.Println(taskIds)
- if taskIds == "" || taskIds == "[]" {
- fmt.Println(endTime)
- offical.MasterListCfgSave("0", "tik_tok_task_appid_time_"+v, utils.Int64ToStr(endTime))
- continue
- }
- CommAddTask("tik_tok_task_"+v, taskIds)
- var tmp = make([]int64, 0)
- json.Unmarshal([]byte(taskIds), &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) {
- data := md3.KujiangData
- var kujiang []md.KuJiang
- json.Unmarshal([]byte(data), &kujiang)
- kujiangMap := make(map[string]md.KuJiang)
- for _, v := range kujiang {
- kujiangMap[utils.IntToStr(v.BookId)] = v
- }
- xinghes := map[string]string{
-
- "7380190485731639322": "https://pan.baidu.com/s/1L8zOJCMdBIwdEvkLV2O4Nw?pwd=miof",
- "7379912213080883200": "https://pan.baidu.com/s/1NBh7T8wsKg-qUv37lZh5Vg?pwd=qi55",
- "7379861578981703695": "https://pan.baidu.com/s/1thjZIuLkMj2QUNEc3xLVFg?pwd=uvqo",
- "7379784012149112872": "https://pan.baidu.com/s/1p9mCmmkrq0pDcNTSW0xtLg?pwd=aa57",
- "7379784012149096488": "https://pan.baidu.com/s/1ZOINZXHrH_PnSwnEFRWN-Q?pwd=fz0g",
- "7379804114810634276": "https://pan.baidu.com/s/1_RMKz-qqw96mqFN5N--zoQ?pwd=s9vb",
- "7379461837433307173": "https://pan.baidu.com/s/1MTqjaO3oKt8KS-zTfXoG_Q?pwd=03l9",
- "7379413447399784498": "https://pan.baidu.com/s/1JPuFx_a-AgDUMuotdoQhMg?pwd=9tch",
- "7379413956869242906": "https://pan.baidu.com/s/1Z38OjOKTYaC6Eo4mePWlLg?pwd=qoo4",
- "7379040298610999332": "https://pan.baidu.com/s/1Wq4GKZJk49WvKNvp55xMqA?pwd=9zal",
- "7377925238903881754": "https://pan.baidu.com/s/1ZhHrU40YMITyRwh0_evn-g?pwd=i77m",
- "7377636356299898931": "https://pan.baidu.com/s/1bUN8GLg27dHkAKY8Arn98w?pwd=9lo9",
- "7377560679844216847": "https://pan.baidu.com/s/1wN3ZB2ElEIbS2-GvJEjy-g?pwd=kgro",
- "7377197073747263522": "https://pan.baidu.com/s/1MZIxhxCu8OmxxcyRGJgWZw?pwd=szb7",
- "7377173468921561107": "https://pan.baidu.com/s/1ln8r84Y5d-mKR6aaG-6icQ?pwd=ssdy",
- "7376820249691324457": "https://pan.baidu.com/s/16qnmC03QmYGxfvfHpVOPbg?pwd=ks1p",
- "7376445276631875647": "https://pan.baidu.com/s/1CRNqanQDrzPpkrhCDxa3rQ?pwd=p8ot",
- "7376060139776032818": "https://pan.baidu.com/s/1b8HMzsiQCULZW3wYXro1qw?pwd=8sdo",
- "7374948827419213834": "https://pan.baidu.com/s/1Tkyt0TvamMMvD1LD-Nmamg?pwd=b05e",
- "7374701175310221339": "https://pan.baidu.com/s/1JOzWUcJeVwu9NShnieBMXw?pwd=kqjj",
- "7374581090054389801": "https://pan.baidu.com/s/1PKT83xe0hMIuat0D81iumQ?pwd=1akn",
- "7373833654033809447": "https://pan.baidu.com/s/15cMH1ds8gT0CGymSBO1NIQ?pwd=sqfr",
- "7373480427329159203": "https://pan.baidu.com/s/1-OYIB1RmTXl3SeynP3Dy7Q?pwd=d2tx",
- "7372912752035119144": "https://pan.baidu.com/s/1ICIGA5SBCXNwugJM3IxaoA?pwd=eae0",
- "7372349272928403482": "https://pan.baidu.com/s/1zms9c0CG07-2kZVFKxYzVw?pwd=fie2",
- "7372080132082778152": "https://pan.baidu.com/s/125VKEkXRa3FkgTdR7gqhvw?pwd=wrbx",
- "7372009394361401344": "https://pan.baidu.com/s/1acDqOnZEfv6IIFEAUl5ffQ?pwd=1nyb",
- "7372013980895985701": "https://pan.baidu.com/s/1azZYwHx1jWLjtz8gc2leFA?pwd=a53c",
- "7371376162850750501": "https://pan.baidu.com/s/14vjCx7AKi0gIsljs-0XGuw?pwd=ib54",
- "7371371539645661211": "https://pan.baidu.com/s/1Xy0x6qlQDjR7LIjkX01nGA?pwd=oik9",
- "7371366982576308287": "https://pan.baidu.com/s/1VjwcogPOHuy25te9zEBERw?pwd=29sq",
- "7371001858434793526": "https://pan.baidu.com/s/1lcXNSZ9z6be83v4UehkM-w?pwd=oy0r",
- "7371001571926081590": "https://pan.baidu.com/s/1ETttvHJd2_fDNuJRuCaKsQ?pwd=dv28",
- "7370904753900945460": "https://pan.baidu.com/s/1PVM9Jpaf93V_--0d1UW9Dg?pwd=bogh",
- "7370911902962221119": "https://pan.baidu.com/s/1DQAvDk8zE0glH81TRvQhfg?pwd=ye4u",
- "7370857345389297699": "https://pan.baidu.com/s/1MhJYTpXqUgPnOrJ2mvVClQ?pwd=mo78",
- "7369875298587836455": "https://pan.baidu.com/s/1P5mGA0QKiRcHHgE1Bzz1cg?s4pn",
- "7369875429492113419": "https://pan.baidu.com/s/1ZHldm5KDXka_5arInJiDQw?pwd=avqw",
- "7369888148781809698": "https://pan.baidu.com/s/1ErZRBvvMOQlaZcyuDHfB_g?pwd=lo2y",
- "7369813564837642281": "https://pan.baidu.com/s/1-Ks0ArP_8mKIsNgDAqI7PA?pwd=d86a",
- "7369751707867283506": "https://pan.baidu.com/s/14qOLJey1bWEA0pqFF6xhgw?pwd=5cmc",
- "7369503459801956371": "https://pan.baidu.com/s/1vyXKrJeuvx5x4w-acbVa6A?pwd=qugd",
- "7369391591624163364": "https://pan.baidu.com/s/1eM2tbZ8yj6zIDqovSO49_A?pwd=aqg2",
- "7369392341066498111": "https://pan.baidu.com/s/12t76uMp_3sn8hdMDoXwppg?pwd=tpfe",
- "7369148051795017740": "https://pan.baidu.com/s/13_S-8fE21nqSofjgx_rWKw?pwd=uns8",
- "7369059651461283894": "https://pan.baidu.com/s/1Fqbpz35M8dwxX8tFhpyQhQ?pwd=uexq",
- "7369037096285175808": "https://pan.baidu.com/s/1_Y2LnJeAG1-QJUCNegiKuA?pwd=jcjv",
- "7368762632674803751": "https://pan.baidu.com/s/1bjiyXlw_sMQ9YR4YALu3ZQ?pwd=aic8",
- "7368679769661079564": "https://pan.baidu.com/s/1Rrqm6C_VCP9pTLIiytJFew?pwd=0w3y",
- "7368678622070489139": "https://pan.baidu.com/s/1ImxFZxOihIxmpKs7FQNC-A?pwd=6dgz",
- "7368653781052981283": "https://pan.baidu.com/s/15jtQvEYxQujqY3C_zeE_fA?pwd=mcy5",
- "7368329261691961371": "https://pan.baidu.com/s/171ZRDKRRU3aP7ZMBDy0vsQ?pwd=sipq",
- "7368324603678031882": "https://pan.baidu.com/s/1B5Qh3vs3Ivfk8rTLCc1tng?pwd=emws",
- "7367710375317520399": "https://pan.baidu.com/s/1aEaDUhSM-4VDTxn40wXm3A?pwd=6e8b",
- "7367316323904372772": "https://pan.baidu.com/s/1kf58ZCgI0BgCLQapMfrTbQ?pwd=cceg",
- "7366906746314555404": "https://pan.baidu.com/s/1MNfbPba3Nt2pTnHTfBUEBA?pwd=ew3v",
- "7366486018851209235": "https://pan.baidu.com/s/1QWF63ao80TT3BAMV0-QpRA?pwd=rcs5",
- "7366151010714157097": "https://pan.baidu.com/s/1055EkwtBxPM0Sw6L5gOCFw?pwd=1sq9",
- "7366102746245726248": "https://pan.baidu.com/s/1WzXSrkemz0Hm0DTNcmTpxA?pwd=y2j0",
- "7365004815451062312": "https://pan.baidu.com/s/1q2XYO3GraSEvdX2F3JcX4Q?pwd=glby",
- "7364352540936290358": "https://pan.baidu.com/s/11JDyHl97egRjDKxnH9D7rQ?pwd=mr0l",
- "7363525995279745035": "https://pan.baidu.com/s/1te89FR6rULnXV7g5BaRIPA?pwd=hx47",
- "7363532419464429619": "https://pan.baidu.com/s/1JBXBddSdLeZn-BOFYCjQrA?pwd=y1iu",
- "7363505120711098368": "https://pan.baidu.com/s/1iAP5OSU46CFz0vyOYGOBCA?pwd=ft2t",
- "7363505153716125731": "https://pan.baidu.com/s/1Lpuc4iUBWxndb1xTcRoicQ?pwd=390v",
- "7363505437439918121": "https://pan.baidu.com/s/1Y_RnixE05gaMptBrhC0DQw?pwd=n3ni",
- "7363157598629068819": "https://pan.baidu.com/s/1NPtnl5EBK7jRRgk7kSStPg?pwd=86p6",
- "7363157659111211027": "https://pan.baidu.com/s/1PO8ulobc-54is1QBikJSEQ?pwd=gfek",
- "7362021099053383714": "https://pan.baidu.com/s/19mqfaAt5zovNO1sb0e-bxw?pwd=qae9",
- "7361723753094610980": "https://pan.baidu.com/s/1oybfSKC4FUWGw81DH6wqXw?pwd=a83p",
- "7361713709670006810": "https://pan.baidu.com/s/1r0EAT_q6DKFatnbwXZfeTw?pwd=7h74",
- "7361659856501129279": "https://pan.baidu.com/s/1XtOabN5ZGsxG9x_CjF2Aig?pwd=ztet",
- "7361314021947015222": "https://pan.baidu.com/s/1Wq3RyPsSUw1PBXqPD7nHCA?pwd=hxip",
- "7360937011936510006": "https://pan.baidu.com/s/1WlN5HLmcaADy0jGdiCaGFQ?pwd=tiwb",
- "7359423244304269350": "https://pan.baidu.com/s/1_c4cXt25ky2yDOXm2kmL5A?pwd=bcrq",
- "7359058838047162368": "https://pan.baidu.com/s/1HkBnlRR27JBKsQheTJxmcQ?pwd=3kcd",
- "7358681447030390784": "https://pan.baidu.com/s/1oWMuF5itpF77lls_vSGqJA?pwd=p3wc",
- "7358322670871576616": "https://pan.baidu.com/s/13RET87iAbgZlj-jn5mUwUg?pwd=y9rd",
- "7357194974695391268": "https://pan.baidu.com/s/1cBU9PIXW99Y5W1XhvdPIpA?pwd=uxc6",
- "7356840659325583414": "https://pan.baidu.com/s/1znMbDDAnIRQ7PwtiznOvTQ?pwd=9nj7",
- "7355357328834658319": "https://pan.baidu.com/s/1uoDFjFm9iWt5eXGCYwx0Sg?pwd=9i8p",
- "7353386971026309183": "https://pan.baidu.com/s/1LCgvkFblrE43e4JtxSOR4Q?pwd=svb5",
- "7350898126372323369": "https://pan.baidu.com/s/1P6E4vYl-2x0s_qw1X5oviQ?pwd=84xz",
- "7350859162219184139": "https://pan.baidu.com/s/1mUHucK0x5af8G40hJbLzqw?pwd=0dh1",
- "7349282971213512754": "https://pan.baidu.com/s/18QgGyqjzW7aImhQ8a2_SJQ?pwd=aswx",
- "7348970835950043147": "https://pan.baidu.com/s/1JEL9kvkrvzcZUKwexlhPhw?pwd=gadt",
- "7348684759972724745": "https://pan.baidu.com/s/1sqnsG74rqE8vKVz4-mibgw?pwd=q7us",
- "7348649376765460531": "https://pan.baidu.com/s/18AIW_J7XHGZFbEsa4zbEZw?pwd=akgy",
- "7348320058776502322": "https://pan.baidu.com/s/1RImOhdsbwT-d58U8x9Cl7g?pwd=5oy1",
- "7348220904138227746": "https://pan.baidu.com/s/1WL1ZCM5w9opVJRHq2_tQkg?pwd=08gs",
- "7347939532555304972": "https://pan.baidu.com/s/1A3vmJaRPU9YFmNZje9ttDw?pwd=2vjp",
- "7347576656296443941": "https://pan.baidu.com/s/106MDSCSM7BCTx_1kex65gA?pwd=t1gm",
- "7346064108011257897": "https://pan.baidu.com/s/1NY7JuB-2KUlvtbKZqI7vew?pwd=kpt4",
- "7345229086283055156": "https://pan.baidu.com/s/1mkkF_bhOh3E7sZf6ymIv0g?pwd=zl3m",
- "7344970667663589410": "https://pan.baidu.com/s/17e5bb0dGQ183zHWkO49cmg?pwd=l193",
- "7343744932248600616": "https://pan.baidu.com/s/1vL1g1aGhgXMtNEah4TQFxw?pwd=ub0r",
- "7342692698744193063": "https://pan.baidu.com/s/1MOaSBkuHGzvv9n1GPc-B3Q?pwd=69fg",
- "7340706698497212455": "https://pan.baidu.com/s/1vB8aG2U3kserxWsm3bR1Zg?pwd=qszf",
- "7340019974860914715": "https://pan.baidu.com/s/1bykE9LVcNCePutJ4Rmz14A?pwd=dvrx",
- "7338982451538133026": "https://pan.baidu.com/s/10GqBT2oBHTdIrtLvm7C3Mg?pwd=203x",
- "7336393071648587816": "https://pan.baidu.com/s/1Zl0zxZg3dcTuGsge8pD-SA?pwd=este",
- "7335313319047315456": "https://pan.baidu.com/s/1QQZQlgy-WN9hXKjSe59smg?pwd=klno",
- "7334158528300482571": "https://pan.baidu.com/s/1DuWh9nZwec3uTAoqwLzIEA?pwd=qs0v",
- "7333417334876454949": "https://pan.baidu.com/s/1l5FvB35F9YPnwllSpYPvSA?pwd=ogdy",
- "7333416896286507044": "https://pan.baidu.com/s/1S2E0DXe1w6z5kU5r9fGGoQ?pwd=k0br",
- "7332303743809011739": "https://pan.baidu.com/s/1S4I4smzV8I3-jytmua1kLg?pwd=2zhv",
- "7331643707597864997": "https://pan.baidu.com/s/1WWMY8bWnNLSxCaD0x_Gv0Q?pwd=scm5",
- "7331637776204480575": "https://pan.baidu.com/s/1PAYJUrYhZ71XivTZFSxw5Q?pwd=v1n7",
- "7330834016368623657": "https://pan.baidu.com/s/1yB46HJtIjjffc0w8RmeRTQ?pwd=x1v3",
- "7330529933564919823": "https://pan.baidu.com/s/1PzKUtgetU8bVTILFYxSrNQ?pwd=ul4a",
- "7330518079224512550": "https://pan.baidu.com/s/1I1o9UV89oYCVmzJc5bCe1g?pwd=5nxe",
- "7327911477510209548": "https://pan.baidu.com/s/1ebMtvlMV2UCCvTOx7znFsA?pwd=d00o",
- "7326049857058177024": "https://pan.baidu.com/s/1WtKwzdeiPQz0AjKzieU_6w?pwd=prkh",
- "7324972262531153959": "https://pan.baidu.com/s/1qZCfNogUvYWWlkJ225qNQQ?pwd=l0ui",
- "7324518767126429734": "https://pan.baidu.com/s/1J7CJYI76-I-9APIq1pzE5A?pwd=ai6t",
- "7324518215852228644": "https://pan.baidu.com/s/1w7qG9kSfpZD1hCohnU8vUQ?pwd=0a3w",
- "7324510965024751650": "https://pan.baidu.com/s/1bzzIqBftk030n8ZRddnnRA?pwd=6k6e",
- "7320876050387353611": "https://pan.baidu.com/s/1Y6oe-upHqA72ivDp4MWBUA?pwd=04th",
- "7318971545959170058": "https://pan.baidu.com/s/1jEOgXAR7e5Oqd3KZ2e1zyg?pwd=wvb9",
- "7313727507914686476": "https://pan.baidu.com/s/1awg3uiLk5t1EJPGiUXhxyQ?pwd=ppwu",
- "7313751212422201379": "https://pan.baidu.com/s/1awg3uiLk5t1EJPGiUXhxyQ?pwd=ppwu",
- "7312337908660437004": "https://pan.baidu.com/s/1Q-6nsaWTmj3UWCdSdOQErw?pwd=4sl3",
- "7312292128947257383": "https://pan.baidu.com/s/1D71HmPOWkAeBmVk9ujU8dQ?pwd=ta3n",
- "7312294620745056267": "https://pan.baidu.com/s/1CI0fC50UWsxKLcQ4AIlUhQ?pwd=pi51",
- "7312295241607790643": "https://pan.baidu.com/s/1-8w4R1ypihnHw-djYQHXcg?pwd=p5h8",
- "7312292122370031670": "https://pan.baidu.com/s/1pZM-FzOQQrZjhgQ_Kn1nAQ?pwd=ryu0",
- "7312291614532599843": "https://pan.baidu.com/s/16794mteTYOn6nzu8k1gIBg?pwd=xdsg",
- "7312007303753957395": "https://pan.baidu.com/s/1hEyBrPTm0Rtkl1mP-1myxQ?pwd=di9v",
- }
- for _, v := range tmp {
- time.Sleep(time.Microsecond * 1000)
- param := map[string]interface{}{
- "appid": appId,
- "query_params_type": "1",
- "query_params_content": utils.Int64ToStr(v),
- "page_no": "1",
- "page_size": "10",
- }
- api, _ := tik_tok.TaskApi("query_task_info/", TikTokTaskToken(), zhios_third_party_utils.SerializeStr(param))
- detail := gjson.Get(api, "data.tasks").String()
- if detail == "" {
- fmt.Println("失败", v)
- continue
- }
- var tmpDetail = make([]md.TikTokTaskDetail, 0)
- json.Unmarshal([]byte(detail), &tmpDetail)
- for _, v1 := range tmpDetail {
- var tmpIn md.TikTokTaskDetailSecond
- err := copier.Copy(&tmpIn, &v1)
- fmt.Println(err)
- tmpIn.OrientedTalentRelList = utils.SerializeStr(v1.OrientedTalentRelList)
- tmpIn.ReferMaCaptures = utils.SerializeStr(v1.ReferMaCaptures)
- tmpIn.TaskTags = utils.SerializeStr(v1.TaskTags)
- tmpIn.ReferVideoCaptures = utils.SerializeStr(v1.ReferVideoCaptures)
-
- videoTmpStr := "bookId="
- if tmpIn.Appid == "tt38e94e54a7d70c4601" {
- videoTmpStr = "cid="
- } else if strings.Contains(tmpIn.StartPage, "novelid=") {
- videoTmpStr = "novelid="
- } else if strings.Contains(tmpIn.StartPage, "book_id=") {
- videoTmpStr = "book_id="
- } 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)
- }
- 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: "",
- }
- if v2["second_type"] == "xinghe" {
- tmp2.Material = xinghes[utils.Int64ToStr(tmpIn.TaskId)]
- }
- uniqueId := php2go.Md5(tmp2.Appid + "_" + tmp2.Type + "_" + tmp2.FirstCate + "_" + utils.IntToStr(tmp2.Id))
- if tmp2.Appid == "ttbed9c86421e54c8501" {
- doc, _ := es.FirstDoc(md2.ZhiosNewVideo, uniqueId)
- if tmpIn.TaskEndTime > int(time.Now().Unix()) {
- tmp2.Platform = "tikTok"
- }
- if doc != nil && strings.Contains(gjson.Get(string(doc.Source), "platform").String(), "kuaishou") {
- if tmpIn.TaskEndTime > int(time.Now().Unix()) {
- tmp2.Platform = "tikTok,kuaishou"
- } else {
- tmp2.Platform = "kuaishou"
- }
- }
-
- jiang, ok := kujiangMap[tmpIn.VideoId]
- if ok {
- tmp2.Material = jiang.WebDiskUrl
- }
- } else {
- tmp2.Platform = "tikTok"
- if tmpIn.TaskEndTime < int(time.Now().Unix()) {
- tmp2.IsClose = 1
- }
- }
- if tmp2.Platform == "" {
- tmp2.IsClose = 1
- }
- fmt.Println(uniqueId)
- tmp2.Key = uniqueId
- commAddNew(uniqueId, tmp2)
- }
- }
- CommAddTaskDetail(utils.Int64ToStr(tmpIn.TaskId), tmpIn)
- }
- }
- }
- func CommAddTask(uniqueId string, taskIds string) {
- doc, _ := es.FirstDoc(md2.ZhiosTikTokTaskEsIndex, uniqueId)
- if doc == nil {
- var tmpData = map[string]string{
- "task_ids": taskIds,
- }
- createDocRet, err := es.CreateDoc(md2.ZhiosTikTokTaskEsIndex, uniqueId, tmpData)
- if err != nil {
- return
- }
- fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet)
- } else {
- source := doc.Source
- tmpData := make(map[string]string)
- json.Unmarshal(source, &tmpData)
-
- var tmpOld = make([]int64, 0)
- json.Unmarshal([]byte(tmpData["task_ids"]), &tmpOld)
-
- var tmp = make([]int64, 0)
- json.Unmarshal([]byte(taskIds), &tmp)
- tmp = utils.MergeArr(tmpOld, tmp)
- tmp = utils.UniqueArr(tmp)
- tmpData = map[string]string{
- "task_ids": utils.SerializeStr(tmp),
- }
- createDocRet, err := es.UpdateDoc(md2.ZhiosTikTokTaskEsIndex, uniqueId, tmpData)
- if err != nil {
- return
- }
- fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet)
- }
- }
- func CommAddTaskDetail(uniqueId string, tmp md.TikTokTaskDetailSecond) {
- doc, _ := es.FirstDoc(md2.ZhiosTikTokTaskDetailEsIndex, uniqueId)
- if doc == nil {
-
- createDocRet, err := es.CreateDoc(md2.ZhiosTikTokTaskDetailEsIndex, uniqueId, tmp)
- if err != nil {
- return
- }
- fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet)
- } else {
- createDocRet, err := es.UpdateDoc(md2.ZhiosTikTokTaskDetailEsIndex, uniqueId, tmp)
- if err != nil {
- return
- }
- fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet)
- }
- }
-
- func TikTokTaskToken() string {
- tikTokOpenAppkey := offical.MasterListCfgGetOneData("0", "tik_tok_task_open_appkey")
- tikTokOpenAppSecret := offical.MasterListCfgGetOneData("0", "tik_tok_task_open_app_secret")
- args := map[string]string{
- "appkey": tikTokOpenAppkey,
- "appSecret": tikTokOpenAppSecret,
- }
- 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"] != "" {
- tokeStr = token["tik_tok_acc_token"]
- cache.SetEx(key, token["tik_tok_acc_token"], utils.StrToInt(token["expires_in"]))
- }
- }
- return tokeStr
- }
|