|
- package svc
-
- import (
- "applet/app/db"
- "applet/app/db/model"
- "applet/app/task/md"
- "applet/app/utils"
- "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"
- "github.com/tidwall/gjson"
- "time"
- )
-
- func TikTokTaskRelate() {
- p := 1
- for {
- param := map[string]interface{}{
- "page_no": p,
- "page_size": 100,
- }
- api, _ := tik_tok.TaskApi("get_agency_user_bind_record/", TikTokTaskToken(), zhios_third_party_utils.SerializeStr(param))
- user := gjson.Get(api, "data.results").String()
- if user == "" {
- break
- }
- var userData = make([]md.TikTokTaskRelate, 0)
- json.Unmarshal([]byte(user), &userData)
- if len(userData) == 0 {
- break
- }
- for _, v := range userData {
- var tmp model.TikTokPlanTeam
- db.ZhimengDb.Where("team_id=? and tik_tok_id=?", v.AgentId, v.DouyinId).Get(&tmp)
- if tmp.Id == 0 {
- tmp = model.TikTokPlanTeam{
- TeamId: utils.Int64ToStr(v.AgentId),
- Ext: v.AgencyTalentUid,
- TikTokId: v.DouyinId,
- IsShow: 1,
- Time: time.Unix(int64(v.BindTime), 0),
- }
- db.ZhimengDb.Insert(&tmp)
- }
- }
- p++
- }
-
- }
|