@@ -0,0 +1,14 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type TikTokPlanTeam struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
TeamId string `json:"team_id" xorm:"VARCHAR(255)"` | |||
Ext string `json:"ext" xorm:"VARCHAR(255)"` | |||
TikTokId string `json:"tik_tok_id" xorm:"VARCHAR(255)"` | |||
IsShow int `json:"is_show" xorm:"default 0 INT(1)"` | |||
Time time.Time `json:"time" xorm:"DATETIME"` | |||
} |
@@ -25,3 +25,13 @@ func MasterListCfgGetKeyAll(key string) *[]model.MasterListCfg { | |||
} | |||
return &cfgList | |||
} | |||
func MasterListCfgSave(uid, key, val string) { | |||
var cfgList model.MasterListCfg | |||
has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList) | |||
if err != nil || has == false { | |||
return | |||
} | |||
cfgList.V = val | |||
db.Db.Where("`k`=? and uid=?", key, uid).Update(&cfgList) | |||
return | |||
} |
@@ -0,0 +1,105 @@ | |||
package md | |||
const ZhiosTikTokTaskEsIndex = "zhios_tik_tok_task" | |||
const ZhiosTikTokTaskDetailEsIndex = "zhios_tik_tok_task_detail" | |||
const ZhiosTikTokTaskEsMapping = ` | |||
{ | |||
"settings" : { | |||
"number_of_shards" : 2, | |||
"number_of_replicas" : 1 | |||
}, | |||
"mappings":{ | |||
"properties":{ | |||
"task_ids":{ | |||
"type": "text" | |||
} | |||
} | |||
} | |||
}` | |||
const ZhiosTikTokTaskDetailEsMapping = ` | |||
{ | |||
"settings" : { | |||
"number_of_shards" : 2, | |||
"number_of_replicas" : 1 | |||
}, | |||
"mappings":{ | |||
"properties":{ | |||
"appid":{ | |||
"type": "keyword" | |||
}, | |||
"task_start_time":{ | |||
"type": "integer" | |||
}, | |||
"task_end_time":{ | |||
"type": "integer" | |||
}, | |||
"page_type":{ | |||
"type": "integer" | |||
}, | |||
"start_page":{ | |||
"type": "keyword" | |||
}, | |||
"task_desc":{ | |||
"type": "keyword" | |||
}, | |||
"task_icon":{ | |||
"type": "keyword" | |||
}, | |||
"task_name":{ | |||
"type": "keyword" | |||
}, | |||
"anchor_title":{ | |||
"type": "keyword" | |||
}, | |||
"status":{ | |||
"type": "integer" | |||
}, | |||
"task_tags":{ | |||
"type": "keyword" | |||
}, | |||
"task_settle_type":{ | |||
"type": "integer" | |||
}, | |||
"task_id":{ | |||
"type": "keyword" | |||
}, | |||
"refer_ma_captures":{ | |||
"type": "keyword" | |||
}, | |||
"refer_video_captures":{ | |||
"type": "keyword" | |||
}, | |||
"refer_videos":{ | |||
"type": "keyword" | |||
}, | |||
"refer_gids":{ | |||
"type": "keyword" | |||
}, | |||
"task_refund_period":{ | |||
"type": "integer" | |||
}, | |||
"payment_allocate_ratio":{ | |||
"type": "integer" | |||
}, | |||
"platform_address_app":{ | |||
"type": "keyword" | |||
}, | |||
"platform_address_web":{ | |||
"type": "keyword" | |||
}, | |||
"reject_reason":{ | |||
"type": "keyword" | |||
}, | |||
"task_type":{ | |||
"type": "integer" | |||
}, | |||
"video_id":{ | |||
"type": "integer" | |||
}, | |||
"oriented_talent_rel_list":{ | |||
"type": "text" | |||
} | |||
} | |||
} | |||
}` |
@@ -1,6 +1,7 @@ | |||
package md | |||
const ZhiosTpdarenEsIndex = "zhios_tpdaren" | |||
const ZhiosTpdarenEsIndexNew = "zhios_tpdaren_new" | |||
const ZhiosTpdarenEsMapping = ` | |||
{ | |||
"settings" : { | |||
@@ -15,6 +16,7 @@ const ZhiosTpdarenEsMapping = ` | |||
"is_hot":{ | |||
"type": "integer" | |||
}, | |||
"video_type":{ | |||
"type": "keyword" | |||
}, | |||
@@ -69,3 +71,77 @@ const ZhiosTpdarenEsMapping = ` | |||
} | |||
} | |||
}` | |||
const ZhiosTpdarenNewEsMapping = ` | |||
{ | |||
"settings" : { | |||
"number_of_shards" : 2, | |||
"number_of_replicas" : 1 | |||
}, | |||
"mappings":{ | |||
"properties":{ | |||
"id":{ | |||
"type": "keyword" | |||
}, | |||
"is_close":{ | |||
"type": "integer" | |||
}, | |||
"is_hot":{ | |||
"type": "integer" | |||
}, | |||
"video_type":{ | |||
"type": "keyword" | |||
}, | |||
"cate":{ | |||
"type": "keyword" | |||
}, | |||
"appid":{ | |||
"type": "keyword" | |||
}, | |||
"description":{ | |||
"type": "keyword" | |||
}, | |||
"episode":{ | |||
"type": "integer" | |||
}, | |||
"channel_theater_id":{ | |||
"type": "integer" | |||
}, | |||
"douyin_theater_id":{ | |||
"type": "integer" | |||
}, | |||
"kuaishou_theater_id":{ | |||
"type": "integer" | |||
}, | |||
"update_time":{ | |||
"type": "integer" | |||
}, | |||
"image_url":{ | |||
"type": "keyword" | |||
}, | |||
"is_end":{ | |||
"type": "integer" | |||
}, | |||
"pay_episode":{ | |||
"type": "integer" | |||
}, | |||
"material":{ | |||
"type": "keyword" | |||
}, | |||
"online_time":{ | |||
"type": "keyword" | |||
}, | |||
"time":{ | |||
"type": "integer" | |||
}, | |||
"type":{ | |||
"type": "keyword" | |||
}, | |||
"title":{ | |||
"type": "keyword" | |||
}, | |||
"data":{ | |||
"type": "text" | |||
} | |||
} | |||
} | |||
}` |
@@ -3,11 +3,21 @@ package hdl | |||
import ( | |||
"applet/app/db" | |||
"applet/app/e" | |||
md2 "applet/app/es/md" | |||
"applet/app/lib/validate" | |||
"applet/app/svc" | |||
"applet/app/task/md" | |||
"applet/app/utils" | |||
"bufio" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" | |||
"encoding/csv" | |||
"encoding/json" | |||
"fmt" | |||
"github.com/gin-gonic/gin" | |||
"github.com/mcuadros/go-defaults" | |||
"github.com/syyongx/php2go" | |||
"strings" | |||
"time" | |||
) | |||
func ImgReqUpload(c *gin.Context) { | |||
@@ -50,3 +60,308 @@ func ImgReqUpload(c *gin.Context) { | |||
e.OutSuc(c, my1, nil) | |||
} | |||
func File(c *gin.Context) { | |||
rFile, _ := c.FormFile("file") | |||
file, err := rFile.Open() | |||
if err != nil { | |||
c.String(400, "文件格式错误") | |||
return | |||
} | |||
//es.CreateIndexIfNotExists(md2.ZhiosTpdarenEsIndexNew, md2.ZhiosTpdarenNewEsMapping) | |||
defer file.Close() | |||
reader := csv.NewReader(bufio.NewReader(file)) | |||
i := 0 | |||
for { | |||
line, err := reader.Read() | |||
if err != nil { | |||
c.String(400, err.Error()) | |||
return | |||
} | |||
if line[0] == "上架时间" { | |||
i++ | |||
continue | |||
} | |||
//line 就是每一行的内容 | |||
fmt.Println(line) | |||
t := time.Now() | |||
var tmp md.TpdarenNew | |||
material := "" | |||
if strings.Contains(line[4], " 提取码") == false { | |||
material = line[4] | |||
} else { | |||
ex := strings.Split(line[4], " 提取码: ") | |||
material = ex[0] | |||
if strings.Contains(material, "?pwd=") == false { | |||
material += "?pwd=" + ex[1] | |||
} | |||
} | |||
material = strings.ReplaceAll(material, "链接:", "") | |||
material = strings.ReplaceAll(material, " ", "") | |||
tmp = md.TpdarenNew{ | |||
Description: line[5], | |||
Episode: utils.StrToInt(line[9]), | |||
Cate: line[6], | |||
ImageUrl: line[12], | |||
IsEnd: 0, | |||
PayEpisode: utils.StrToInt(line[10]), | |||
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"), | |||
Type: "dianzhong", | |||
Title: line[2], | |||
Data: utils.SerializeStr(line), | |||
DouyinTheaterId: 1, | |||
KuaishouTheaterId: 2, | |||
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()), | |||
Appid: "31517", | |||
Id: line[1], | |||
IsClose: 0, | |||
} | |||
i++ | |||
var uniqueId = "" | |||
tmp.VideoType = "douyin" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
commAdd(uniqueId, tmp) | |||
tmp.VideoType = "kuaishou" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
commAdd(uniqueId, tmp) | |||
} | |||
} | |||
func FileTwo(c *gin.Context) { | |||
rFile, _ := c.FormFile("file") | |||
file, err := rFile.Open() | |||
if err != nil { | |||
c.String(400, "文件格式错误") | |||
return | |||
} | |||
//es.CreateIndexIfNotExists(md2.ZhiosTpdarenEsIndexNew, md2.ZhiosTpdarenNewEsMapping) | |||
defer file.Close() | |||
reader := csv.NewReader(bufio.NewReader(file)) | |||
i := 0 | |||
for { | |||
i++ | |||
line, err := reader.Read() | |||
if err != nil { | |||
c.String(400, err.Error()) | |||
return | |||
} | |||
if line[0] == "上架时间" { | |||
continue | |||
} | |||
//line 就是每一行的内容 | |||
fmt.Println(line) | |||
t := time.Now() | |||
var tmp md.TpdarenNew | |||
material := "" | |||
if strings.Contains(line[6], " 提取码") == false { | |||
material = line[6] | |||
} else { | |||
ex := strings.Split(line[6], " 提取码") | |||
material = ex[0] | |||
if strings.Contains(material, "?pwd=") == false { | |||
material += "?pwd=" + ex[1] | |||
} | |||
} | |||
if i > 318 && strings.ReplaceAll(line[0], "月", "") == "12" { | |||
line[0] = "1" | |||
} | |||
material = strings.ReplaceAll(material, "链接:", "") | |||
tmp = md.TpdarenNew{ | |||
Description: line[7], | |||
Episode: utils.StrToInt(line[11]), | |||
Cate: line[8], | |||
ImageUrl: line[14], | |||
IsEnd: 0, | |||
PayEpisode: utils.StrToInt(line[12]), | |||
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"), | |||
Type: "dianzhong", | |||
Title: line[2], | |||
Data: utils.SerializeStr(line), | |||
DouyinTheaterId: 1, | |||
KuaishouTheaterId: 2, | |||
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()), | |||
Appid: "31517", | |||
Id: line[1], | |||
IsClose: 0, | |||
} | |||
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{"上架", "微信小程序下架", "乔陌漓,颜汐落", "抖音下架", "抖音下架、其他媒体上架"}) { | |||
tmp.VideoType = "kuaishou" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
commAdd(uniqueId, tmp) | |||
} | |||
} | |||
} | |||
func FileSecond(c *gin.Context) { | |||
rFile, _ := c.FormFile("file") | |||
file, err := rFile.Open() | |||
if err != nil { | |||
c.String(400, "文件格式错误") | |||
return | |||
} | |||
//es.CreateIndexIfNotExists(md2.ZhiosTpdarenEsIndexNew, md2.ZhiosTpdarenNewEsMapping) | |||
defer file.Close() | |||
reader := csv.NewReader(bufio.NewReader(file)) | |||
i := 0 | |||
day := 10 | |||
for { | |||
line, err := reader.Read() | |||
if err != nil { | |||
c.String(400, err.Error()) | |||
return | |||
} | |||
if len(line) < 4 { | |||
continue | |||
} | |||
if line[3] == "剧集ID" || line[3] == "" { | |||
i++ | |||
continue | |||
} | |||
//line 就是每一行的内容 | |||
fmt.Println(line) | |||
t := time.Now() | |||
var tmp md.TpdarenNew | |||
material := "" | |||
if strings.Contains(line[6], " 提取码") == false { | |||
material = line[6] | |||
} else { | |||
ex := strings.Split(line[6], " 提取码") | |||
material = ex[0] | |||
if strings.Contains(material, "?pwd=") == false { | |||
material += "?pwd=" + ex[1] | |||
} | |||
} | |||
material = strings.ReplaceAll(material, "链接:", "") | |||
tmp = md.TpdarenNew{ | |||
Description: line[7], | |||
Episode: utils.StrToInt(line[11]), | |||
Cate: line[8], | |||
ImageUrl: line[14], | |||
IsEnd: 0, | |||
PayEpisode: utils.StrToInt(line[12]), | |||
Material: material, | |||
OnlineTime: time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Format("2006-01-02 15:04:05"), | |||
Type: "dianzhong", | |||
Title: line[4], | |||
Data: utils.SerializeStr(line), | |||
DouyinTheaterId: 1, | |||
KuaishouTheaterId: 2, | |||
UpdateTime: int(time.Now().Unix()) - i*10, | |||
Time: int(time.Date(t.Year(), time.Month(day), 1, 0, 0, 0, 0, t.Location()).Unix()), | |||
Appid: "31517", | |||
Id: line[3], | |||
IsClose: 0, | |||
} | |||
i++ | |||
var uniqueId = "" | |||
tmp.VideoType = "douyin" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
commAdd(uniqueId, tmp) | |||
tmp.VideoType = "kuaishou" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
commAdd(uniqueId, tmp) | |||
} | |||
} | |||
func FileDown(c *gin.Context) { | |||
rFile, _ := c.FormFile("file") | |||
file, err := rFile.Open() | |||
if err != nil { | |||
c.String(400, "文件格式错误") | |||
return | |||
} | |||
defer file.Close() | |||
reader := csv.NewReader(bufio.NewReader(file)) | |||
i := 0 | |||
for { | |||
line, err := reader.Read() | |||
if err != nil { | |||
c.String(400, err.Error()) | |||
return | |||
} | |||
if line[1] == "ID" { | |||
continue | |||
} | |||
//line 就是每一行的内容 | |||
fmt.Println(line) | |||
tmp := md.TpdarenNew{ | |||
Type: "dianzhong", | |||
Appid: "31517", | |||
Id: line[1], | |||
} | |||
tmp.IsClose = 1 | |||
i++ | |||
var uniqueId = "" | |||
if utils.InArr(line[3], []string{"快手下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用"}) { | |||
tmp.VideoType = "kuaishou" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
fmt.Println(uniqueId) | |||
commDown(uniqueId, tmp) | |||
} | |||
if utils.InArr(line[3], []string{"抖音下架", "版权到期", "全平台下架", "版权到期,全平台下架", "只能H5用", "抖音/微信下架"}) { | |||
tmp.VideoType = "douyin" | |||
uniqueId = php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.VideoType + "_" + tmp.Id) | |||
fmt.Println(uniqueId) | |||
commDown(uniqueId, tmp) | |||
} | |||
} | |||
} | |||
func commAdd(uniqueId string, tmp md.TpdarenNew) { | |||
doc, _ := es.FirstDoc(md2.ZhiosTpdarenEsIndexNew, uniqueId) | |||
if doc == nil { | |||
createDocRet, err := es.CreateDoc(md2.ZhiosTpdarenEsIndexNew, uniqueId, tmp) | |||
if err != nil { | |||
return | |||
} | |||
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet) | |||
} else { | |||
createDocRet, err := es.UpdateDoc(md2.ZhiosTpdarenEsIndexNew, uniqueId, tmp) | |||
if err != nil { | |||
return | |||
} | |||
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet) | |||
} | |||
} | |||
func commDown(uniqueId string, tmp md.TpdarenNew) { | |||
doc, _ := es.FirstDoc(md2.ZhiosTpdarenEsIndexNew, uniqueId) | |||
if doc == nil { | |||
} else { | |||
var tmpDoc md.TpdarenNew | |||
json.Unmarshal(doc.Source, &tmpDoc) | |||
tmpDoc.IsClose = tmp.IsClose | |||
createDocRet, err := es.UpdateDoc(md2.ZhiosTpdarenEsIndexNew, uniqueId, tmpDoc) | |||
if err != nil { | |||
return | |||
} | |||
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet) | |||
} | |||
} |
@@ -64,6 +64,10 @@ func routeInternal(r *gin.RouterGroup) { | |||
} | |||
func routeZhimeng(r *gin.RouterGroup) { | |||
r.GET("/test", hdl.Order) | |||
r.POST("/file", hdl.File) | |||
r.POST("/file_two", hdl.FileTwo) | |||
r.POST("/file_second", hdl.FileSecond) | |||
r.POST("/file_down", hdl.FileDown) | |||
r.GET("/authorizationCode", hdl.GetAuthorizationCode) | |||
r.GET("/token", hdl.GetToken) | |||
r.POST("/rToken", hdl.RefreshToken) | |||
@@ -83,32 +83,38 @@ func doTask(fnName string) func() { | |||
// 增加自动任务队列 | |||
func initTasks() { | |||
jobs[taskMd.ZhimengCronPlayletVideoOrder] = taskPlayletVideoOrder // | |||
jobs[taskMd.ZhimengCronPlayletVideoOrderYesterDay] = taskPlayletVideoOrderYesterday // | |||
jobs[taskMd.ZhimengCronPlayletVideoOrderMonth] = taskPlayletVideoOrderMonth // | |||
jobs[taskMd.ZhimengCronPlayletAdvOrderMonth] = taskPlayletAdvOrderMonth // | |||
jobs[taskMd.ZhimengCronPlayletAdvOrder] = taskPlayletAdvOrder // | |||
jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDay] = taskPlayletAdvOrderYesterday // | |||
jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDayToMoney] = taskPlayletAdvOrderYesterdayToMoney // | |||
jobs[taskMd.ZhimengCronPlayletGoods] = taskPlayletGoods // | |||
jobs[taskMd.ZhimengCronPlayletOrderSettle] = taskPlayletOrderSettle // | |||
jobs[taskMd.ZhimengCronHwOrderSettle] = taskHwOrderSettle // | |||
jobs[taskMd.ZhimengCronMasterMonthSettle] = taskMasterMonthSettle // | |||
jobs[taskMd.ZhimengCronHwStarbucksOrder] = taskHwStarbucksOrder // | |||
jobs[taskMd.ZhimengCronHwMovieOrder] = taskHwMovieOrder // | |||
jobs[taskMd.ZhimengCronHwMcdonaldOrder] = taskHwMcdonaldOrder // | |||
jobs[taskMd.ZhimengCronHwNayukiOrder] = taskHwNayukiOrder // | |||
jobs[taskMd.ZhimengCronHwLuckinOrder] = taskHwLuckinOrder // | |||
jobs[taskMd.ZhimengCronHwPizzaOrder] = taskHwPizzaOrder // | |||
jobs[taskMd.ZhimengCronHwPagodaOrder] = taskHwPagodaOrder // | |||
jobs[taskMd.ZhimengCronHwBurgerKingOrder] = taskHwBurgerKingOrder // | |||
jobs[taskMd.ZhimengCronHwHeyteaOrder] = taskHwHeyteaOrder // | |||
jobs[taskMd.ZhimengCronHwToKfcOrder] = taskHwToKfcOrder // | |||
jobs[taskMd.ZhimengCronHwWallaceOrder] = taskHwWallaceOrder // | |||
jobs[taskMd.ZhimengCronHwFlowerCakeOrder] = taskHwFlowerCakeOrder // | |||
jobs[taskMd.ZhimengCronHwDeliveryOrder] = taskHwDeliveryOrder // | |||
jobs[taskMd.ZhimengCronHwTourismOrder] = taskHwTourismOrder // | |||
jobs[taskMd.ZhimengCronTikTokLocalLifeOrder] = taskTikTokLocalLifeOrder // | |||
jobs[taskMd.ZhimengCronTikTokLocalLifeOrderSettle] = taskTikTokLocalLifeOrderSettle // | |||
jobs[taskMd.ZhimengCronTikTokTask] = taskTikTokTask // | |||
jobs[taskMd.ZhimengCronTikTokTaskRelate] = taskTikTokTaskRelate // | |||
jobs[taskMd.ZhimengCronTikTokTaskMoney] = taskTikTokTaskMoney // | |||
jobs[taskMd.ZhimengCronTikTokTaskMoneyByYestday] = taskTikTokTaskMoneyByYestday // | |||
jobs[taskMd.ZhimengCronDianzhongKuaishouMoney] = taskDianzhongKuaishouMoney // | |||
//jobs[taskMd.ZhimengCronPlayletVideoOrder] = taskPlayletVideoOrder // | |||
//jobs[taskMd.ZhimengCronPlayletVideoOrderYesterDay] = taskPlayletVideoOrderYesterday // | |||
//jobs[taskMd.ZhimengCronPlayletVideoOrderMonth] = taskPlayletVideoOrderMonth // | |||
//jobs[taskMd.ZhimengCronPlayletAdvOrderMonth] = taskPlayletAdvOrderMonth // | |||
//jobs[taskMd.ZhimengCronPlayletAdvOrder] = taskPlayletAdvOrder // | |||
//jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDay] = taskPlayletAdvOrderYesterday // | |||
//jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDayToMoney] = taskPlayletAdvOrderYesterdayToMoney // | |||
//jobs[taskMd.ZhimengCronPlayletGoods] = taskPlayletGoods // | |||
jobs[taskMd.ZhimengCronPlayletOrderSettle] = taskPlayletOrderSettle // | |||
jobs[taskMd.ZhimengCronHwOrderSettle] = taskHwOrderSettle // | |||
jobs[taskMd.ZhimengCronMasterMonthSettle] = taskMasterMonthSettle // | |||
jobs[taskMd.ZhimengCronHwStarbucksOrder] = taskHwStarbucksOrder // | |||
jobs[taskMd.ZhimengCronHwMovieOrder] = taskHwMovieOrder // | |||
jobs[taskMd.ZhimengCronHwMcdonaldOrder] = taskHwMcdonaldOrder // | |||
jobs[taskMd.ZhimengCronHwNayukiOrder] = taskHwNayukiOrder // | |||
jobs[taskMd.ZhimengCronHwLuckinOrder] = taskHwLuckinOrder // | |||
jobs[taskMd.ZhimengCronHwPizzaOrder] = taskHwPizzaOrder // | |||
jobs[taskMd.ZhimengCronHwPagodaOrder] = taskHwPagodaOrder // | |||
jobs[taskMd.ZhimengCronHwBurgerKingOrder] = taskHwBurgerKingOrder // | |||
jobs[taskMd.ZhimengCronHwHeyteaOrder] = taskHwHeyteaOrder // | |||
jobs[taskMd.ZhimengCronHwToKfcOrder] = taskHwToKfcOrder // | |||
jobs[taskMd.ZhimengCronHwWallaceOrder] = taskHwWallaceOrder // | |||
jobs[taskMd.ZhimengCronHwFlowerCakeOrder] = taskHwFlowerCakeOrder // | |||
jobs[taskMd.ZhimengCronHwDeliveryOrder] = taskHwDeliveryOrder // | |||
jobs[taskMd.ZhimengCronHwTourismOrder] = taskHwTourismOrder // | |||
jobs[taskMd.ZhimengCronTikTokLocalLifeOrder] = taskTikTokLocalLifeOrder // | |||
jobs[taskMd.ZhimengCronTikTokLocalLifeOrderSettle] = taskTikTokLocalLifeOrderSettle // | |||
} |
@@ -1,6 +1,11 @@ | |||
package md | |||
const ( | |||
ZhimengCronTikTokTaskRelate = "zhimeng_cron_tik_tok_relate" | |||
ZhimengCronTikTokTask = "zhimeng_cron_tik_tok_task" //短剧订单 | |||
ZhimengCronTikTokTaskMoney = "zhimeng_cron_tik_tok_task_money" //短剧订单 | |||
ZhimengCronTikTokTaskMoneyByYestday = "zhimeng_cron_tik_tok_task_money_by_yestday" | |||
ZhimengCronDianzhongKuaishouMoney = "zhimeng_cron_dianzhong_kuaishou_money" | |||
ZhimengCronPlayletVideoOrder = "zhimeng_cron_playlet_video_order" //短剧订单 | |||
ZhimengCronPlayletAdvOrder = "zhimeng_cron_playlet_adv_order" //短剧广告订单 | |||
ZhimengCronPlayletVideoOrderYesterDay = "zhimeng_cron_playlet_video_order_yesterday" | |||
@@ -0,0 +1,80 @@ | |||
package md | |||
type TikTokTaskDetail struct { | |||
AnchorTitle string `json:"anchor_title"` | |||
Appid string `json:"appid"` | |||
PaymentAllocateRatio int `json:"payment_allocate_ratio"` | |||
PlatformAddressApp string `json:"platform_address_app"` | |||
PlatformAddressWeb string `json:"platform_address_web"` | |||
ReferMaCaptures []string `json:"refer_ma_captures"` | |||
ReferVideoCaptures []string `json:"refer_video_captures"` | |||
RejectReason string `json:"reject_reason"` | |||
StartPage string `json:"start_page"` | |||
Status int `json:"status"` | |||
TaskDesc string `json:"task_desc"` | |||
TaskEndTime int `json:"task_end_time"` | |||
TaskIcon string `json:"task_icon"` | |||
TaskId int64 `json:"task_id"` | |||
TaskName string `json:"task_name"` | |||
TaskRefundPeriod int `json:"task_refund_period"` | |||
TaskSettleType int `json:"task_settle_type"` | |||
TaskStartTime int `json:"task_start_time"` | |||
TaskTags []string `json:"task_tags"` | |||
TaskType int `json:"task_type"` | |||
OrientedTalentRelList []struct { | |||
CooperationState int `json:"cooperation_state"` | |||
DouyinId string `json:"douyin_id"` | |||
CancelOperator int `json:"cancel_operator,omitempty"` | |||
} `json:"oriented_talent_rel_list"` | |||
} | |||
type TikTokTaskDetailSecond struct { | |||
AnchorTitle string `json:"anchor_title"` | |||
Appid string `json:"appid"` | |||
PaymentAllocateRatio int `json:"payment_allocate_ratio"` | |||
PlatformAddressApp string `json:"platform_address_app"` | |||
PlatformAddressWeb string `json:"platform_address_web"` | |||
ReferMaCaptures string `json:"refer_ma_captures"` | |||
ReferVideoCaptures string `json:"refer_video_captures"` | |||
RejectReason string `json:"reject_reason"` | |||
StartPage string `json:"start_page"` | |||
Status int `json:"status"` | |||
TaskDesc string `json:"task_desc"` | |||
TaskEndTime int `json:"task_end_time"` | |||
TaskIcon string `json:"task_icon"` | |||
TaskId int64 `json:"task_id"` | |||
VideoId string `json:"video_id"` | |||
TaskName string `json:"task_name"` | |||
TaskRefundPeriod int `json:"task_refund_period"` | |||
TaskSettleType int `json:"task_settle_type"` | |||
TaskStartTime int `json:"task_start_time"` | |||
TaskTags string `json:"task_tags"` | |||
TaskType int `json:"task_type"` | |||
OrientedTalentRelList string `json:"oriented_talent_rel_list"` | |||
} | |||
type TikTokTaskOrder struct { | |||
VideoId int64 `json:"VideoId"` | |||
TaskId int `json:"TaskId"` | |||
TaskName string `json:"TaskName"` | |||
PublishTime int `json:"PublishTime"` | |||
Author string `json:"Author"` | |||
DouyinID string `json:"DouyinID"` | |||
VideoTitle string `json:"VideoTitle"` | |||
MicroAppTitle string `json:"MicroAppTitle"` | |||
VideoLink string `json:"VideoLink"` | |||
AgentID string `json:"AgentID"` | |||
TalentProfit1D int `json:"TalentProfit1d"` | |||
GMV1D int `json:"GMV1d"` | |||
RefundGMV1D int `json:"RefundGMV1d"` | |||
AdShareCost1D int `json:"AdShareCost1d"` | |||
FeedAdShareCost1D int `json:"FeedAdShareCost1d"` | |||
BillingRefundGMV1D int `json:"BillingRefundGMV1d"` | |||
BillingGMV1D int `json:"BillingGMV1d"` | |||
Date string `json:"date"` | |||
} | |||
type TikTokTaskRelate struct { | |||
AgencyTalentUid string `json:"agency_talent_uid"` | |||
AgentId int64 `json:"agent_id"` | |||
BindTime int `json:"bind_time"` | |||
DouyinId string `json:"douyin_id"` | |||
} |
@@ -22,6 +22,30 @@ type Tpdaren struct { | |||
ShareTitle string `json:"share_title"` | |||
Appid string `json:"appid"` | |||
} | |||
type TpdarenNew struct { | |||
Id string `json:"id"` | |||
Description string `json:"description"` | |||
Cate string `json:"cate"` | |||
Episode int `json:"episode"` | |||
ImageUrl string `json:"image_url"` | |||
IsEnd int `json:"is_end"` | |||
IsClose int `json:"is_close"` | |||
IsHot int `json:"is_hot"` | |||
PayEpisode int `json:"pay_episode"` | |||
Material string `json:"material"` | |||
OnlineTime string `json:"online_time"` | |||
Type string `json:"type"` | |||
Title string `json:"title"` | |||
Data string `json:"data"` | |||
VideoType string `json:"video_type"` | |||
ChannelTheaterId int `json:"channel_theater_id"` | |||
DouyinTheaterId int `json:"douyin_theater_id"` | |||
KuaishouTheaterId int `json:"kuaishou_theater_id"` | |||
UpdateTime int `json:"update_time"` | |||
Time int `json:"time"` | |||
ShareTitle string `json:"share_title"` | |||
Appid string `json:"appid"` | |||
} | |||
type TpdarenList struct { | |||
Title string `json:"title"` | |||
Description string `json:"description"` | |||
@@ -0,0 +1,27 @@ | |||
package svc | |||
import ( | |||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||
"fmt" | |||
"github.com/syyongx/php2go" | |||
"strings" | |||
"time" | |||
) | |||
func DianzhongKuaishouMoney() { | |||
clientId := "10007095" | |||
token := "n7crx2j6kFBDEsko9m" | |||
endTime := time.Now().Unix() | |||
startTime := endTime - 3600 | |||
timestamp := zhios_third_party_utils.Int64ToStr(time.Now().UnixNano() / 1e6) | |||
param := map[string]string{ | |||
"clientId": clientId, | |||
"sdate": zhios_third_party_utils.Int64ToStr(startTime), | |||
"edate": zhios_third_party_utils.Int64ToStr(endTime), | |||
"timestamp": timestamp, | |||
"signKey": strings.ToLower(php2go.Md5(clientId + token + timestamp)), //签名秘钥(小写md5(clientId+接口token+timestamp)), | |||
} | |||
post, err := zhios_third_party_utils.CurlPost("https://routine.wqxsw.com/flames/channel/query/order", zhios_third_party_utils.SerializeStr(param), nil) | |||
fmt.Println(string(post)) | |||
fmt.Println(err) | |||
} |
@@ -0,0 +1,165 @@ | |||
package svc | |||
import ( | |||
offical "applet/app/db/official" | |||
md2 "applet/app/es/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/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 { | |||
appidTime := offical.MasterListCfgGetOneData("0", "tik_tok_task_appid_time_"+v) | |||
if appidTime == "" { | |||
appidTime = utils.Int64ToStr(time.Now().Unix()) | |||
} | |||
startTime := utils.StrToInt64(appidTime) | |||
endTime := startTime + 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) { | |||
for _, v := range tmp { | |||
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) | |||
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 | |||
} | |||
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 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 | |||
} |
@@ -0,0 +1,94 @@ | |||
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" | |||
"fmt" | |||
"github.com/tidwall/gjson" | |||
"strings" | |||
"time" | |||
) | |||
func TikTokTaskMoney(types string) { | |||
endTime := time.Now().Unix() | |||
startTime := endTime - 89*86400 | |||
now := zhios_third_party_utils.GetTimeRange("today") | |||
if types == "yestday" { | |||
now["start"] = now["start"] - 10 | |||
} | |||
if types == "now" { | |||
now["start"] = now["start"] - 10 - 86400 | |||
} | |||
date := time.Unix(now["start"], 0).Format("2006-01-02") | |||
p := 1 | |||
for { | |||
param := map[string]interface{}{ | |||
"page_no": p, | |||
"page_size": 100, | |||
"video_publish_start_time": startTime, | |||
"billing_date": date, | |||
"video_publish_end_time": endTime, | |||
} | |||
api, _ := tik_tok.TaskApi("query_agency_video_daily_data/", TikTokTaskToken(), zhios_third_party_utils.SerializeStr(param)) | |||
fmt.Println(api) | |||
orderStr := gjson.Get(api, "data.results").String() | |||
if orderStr == "" { | |||
break | |||
} | |||
var order = make([]md.TikTokTaskOrder, 0) | |||
json.Unmarshal([]byte(orderStr), &order) | |||
for _, v := range order { | |||
discount := v.BillingGMV1D - v.BillingRefundGMV1D | |||
if discount < 0 { | |||
discount = 0 | |||
} | |||
commission := discount - v.TalentProfit1D - discount*15 | |||
fee := discount - commission | |||
oid := "douyin" + zhios_third_party_utils.Int64ToStr(v.VideoId) + date | |||
oid = strings.ReplaceAll(oid, "_", "") | |||
oid = strings.ReplaceAll(oid, "-", "") | |||
oid = strings.ReplaceAll(oid, " ", "") | |||
oid = strings.ReplaceAll(oid, ":", "") | |||
var tikTokData model.TikTokPlanTeam | |||
db.ZhimengDb.Where("team_id=? and tik_tok_id=?", v.AgentID, v.DouyinID).Get(&tikTokData) | |||
if tikTokData.Id == 0 || tikTokData.Ext == "" { | |||
continue | |||
} | |||
split := strings.Split(tikTokData.Ext, "_") | |||
var tmp = model.PlayletSaleOrder{ | |||
Uid: split[0], | |||
SubUid: utils.StrToInt(split[1]), | |||
Data: utils.SerializeStr(v), | |||
Oid: oid, | |||
Amount: utils.Float64ToStr(float64(discount) / 100), | |||
Commission: utils.Float64ToStr(float64(commission) / 100), | |||
CreateTime: utils.TimeParseStd(date + " 00:00:00"), | |||
UpdateTime: time.Now(), | |||
Title: v.VideoTitle, | |||
VideoType: "douyin", | |||
PlatformType: "dianzhong", | |||
GoodsType: "playlet", | |||
OrdType: "video", | |||
ExtendUid: v.DouyinID + "_" + v.AgentID, | |||
PlatformFee: utils.Float64ToStr(float64(fee) / 100), | |||
} | |||
playletSaleOrderDb := db.PlayletSaleOrderDb{} | |||
playletSaleOrderDb.Set() | |||
ord := playletSaleOrderDb.GetPlayletVideoOrderByOid(tmp.Oid, tmp.OrdType) | |||
tmp.Status = "订单付款" | |||
if ord != nil { | |||
playletSaleOrderDb.PlayletVideoOrderUpdate(ord.Id, &tmp) | |||
} else { | |||
tmp.CustomOid = utils.OrderUUID(tmp.SubUid) | |||
playletSaleOrderDb.PlayletVideoOrderInsert(&tmp) | |||
} | |||
} | |||
p++ | |||
} | |||
return | |||
} |
@@ -0,0 +1,49 @@ | |||
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++ | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskDianzhongKuaishouMoney() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.DianzhongKuaishouMoney() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskTikTokTask() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.TikTokTask() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskTikTokTaskMoney() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.TikTokTaskMoney("now") | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskTikTokTaskMoneyByYestday() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.TikTokTaskMoney("yestday") | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskTikTokTaskRelate() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.TikTokTaskRelate() | |||
<-ch | |||
} |
@@ -153,3 +153,28 @@ func JoinStringsInASCII(data map[string]string, sep string, onlyValues, includeE | |||
} | |||
return strings.Join(list, sep) | |||
} | |||
// 合并数组 | |||
func MergeArr(a, b []int64) []int64 { | |||
var arr []int64 | |||
for _, i := range a { | |||
arr = append(arr, i) | |||
} | |||
for _, j := range b { | |||
arr = append(arr, j) | |||
} | |||
return arr | |||
} | |||
// 去重 | |||
func UniqueArr(m []int64) []int64 { | |||
d := make([]int64, 0) | |||
tempMap := make(map[int64]bool, len(m)) | |||
for _, v := range m { // 以值作为键名 | |||
if tempMap[v] == false { | |||
tempMap[v] = true | |||
d = append(d, v) | |||
} | |||
} | |||
return d | |||
} |
@@ -4,7 +4,7 @@ go 1.15 | |||
require ( | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20230707081910-52e70aa52998 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20231018082154-13bedd001842 | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20231023083145-a61813d50051 | |||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 | |||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | |||
github.com/boombuler/barcode v1.0.1 | |||
@@ -19,6 +19,7 @@ require ( | |||
github.com/go-redis/redis v6.15.9+incompatible | |||
github.com/go-sql-driver/mysql v1.6.0 | |||
github.com/gomodule/redigo v2.0.0+incompatible | |||
github.com/jinzhu/copier v0.3.5 | |||
github.com/makiuchi-d/gozxing v0.1.1 | |||
github.com/mcuadros/go-defaults v1.2.0 | |||
github.com/qiniu/api.v7/v7 v7.8.2 | |||