@@ -0,0 +1,78 @@ | |||
package md | |||
const ZhiosNewVideo = "zhios_new_video" | |||
const ZhiosNewVideoEsMapping = ` | |||
{ | |||
"settings" : { | |||
"number_of_shards" : 2, | |||
"number_of_replicas" : 1 | |||
}, | |||
"mappings":{ | |||
"properties":{ | |||
"id":{ | |||
"type": "integer" | |||
}, | |||
"is_hot":{ | |||
"type": "integer" | |||
}, | |||
"is_close":{ | |||
"type": "integer" | |||
}, | |||
"key":{ | |||
"type": "keyword" | |||
}, | |||
"appid":{ | |||
"type": "keyword" | |||
}, | |||
"first_cate":{ | |||
"type": "keyword" | |||
}, | |||
"type":{ | |||
"type": "keyword" | |||
}, | |||
"title":{ | |||
"type": "keyword" | |||
}, | |||
"description":{ | |||
"type": "keyword" | |||
}, | |||
"second_cate":{ | |||
"type": "keyword" | |||
}, | |||
"episode":{ | |||
"type": "integer" | |||
}, | |||
"platform":{ | |||
"type": "keyword" | |||
}, | |||
"update_time":{ | |||
"type": "integer" | |||
}, | |||
"image_url":{ | |||
"type": "keyword" | |||
}, | |||
"is_end":{ | |||
"type": "integer" | |||
}, | |||
"is_close":{ | |||
"type": "integer" | |||
}, | |||
"pay_episode":{ | |||
"type": "integer" | |||
}, | |||
"material":{ | |||
"type": "keyword" | |||
}, | |||
"online_time":{ | |||
"type": "keyword" | |||
}, | |||
"time":{ | |||
"type": "integer" | |||
}, | |||
"data":{ | |||
"type": "text" | |||
} | |||
} | |||
} | |||
}` |
@@ -21,6 +21,7 @@ func OrderList(c *gin.Context) { | |||
sourceList := []map[string]string{ | |||
{"name": "短剧", "value": "video"}, | |||
{"name": "广告", "value": "adv"}, | |||
{"name": "电影票", "value": "cinema"}, | |||
} | |||
videoList := []map[string]string{ | |||
@@ -1,4 +1,4 @@ | |||
package md | |||
var OrdTypeMap = map[string]string{"video": "短剧", "adv": "广告"} | |||
var OrdTypeMap = map[string]string{"video": "短剧", "adv": "广告", "cinema": "电影票"} | |||
var VideoTypeMap = map[string]string{"channel": "视频号", "douyin": "抖音", "kuaishou": "快手"} |
@@ -64,10 +64,16 @@ 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.GET("/cinema", hdl.Cinema) | |||
r.POST("/bihai_file_new", hdl.BihaiFile) | |||
r.GET("/bihai_add", hdl.BihaiAdd) | |||
r.POST("/file_new", hdl.File) | |||
r.POST("/file_new1", hdl.FileNew) | |||
r.POST("/file_old", hdl.FileTwo) | |||
r.POST("/file_old1", hdl.FileTwoNew) | |||
r.POST("/file_second", hdl.FileSecond) | |||
r.POST("/file_down", hdl.FileDown) | |||
r.POST("/file_down1", hdl.FileDownNew) | |||
r.GET("/authorizationCode", hdl.GetAuthorizationCode) | |||
r.GET("/token", hdl.GetToken) | |||
r.POST("/rToken", hdl.RefreshToken) | |||
@@ -83,6 +83,12 @@ func doTask(fnName string) func() { | |||
// 增加自动任务队列 | |||
func initTasks() { | |||
jobs[taskMd.ZhimengCronPLayletBihaiOrder] = taskPlayletBihaiOrder // | |||
//jobs[taskMd.ZhimengCronCinema5bms] = taskCinema5bms // | |||
jobs[taskMd.ZhimengCronCinema5bmsOrder] = taskCinema5bmsOrder // | |||
jobs[taskMd.ZhimengCronCinema5bmsYesterOrder] = taskCinema5bmsYesterOrder // | |||
jobs[taskMd.ZhimengCronTikTokCsjp] = taskTikTokCsjp // | |||
jobs[taskMd.ZhimengCronTikTokCsjpActivity] = taskTikTokCsjpActivity // | |||
@@ -0,0 +1,18 @@ | |||
package md | |||
type BihaiOrder struct { | |||
HasMore bool `json:"has_more"` | |||
NextId int `json:"next_id"` | |||
List []struct { | |||
OrderId string `json:"order_id"` | |||
MarketId string `json:"market_id"` | |||
CreatedAt string `json:"created_at"` | |||
Status string `json:"status"` | |||
Price string `json:"price"` | |||
LinkId string `json:"link_id"` | |||
PaySystems int `json:"pay_systems"` | |||
Ext struct { | |||
QwExt string `json:"qw_ext"` | |||
} `json:"ext"` | |||
} `json:"list"` | |||
} |
@@ -0,0 +1,68 @@ | |||
package md | |||
type Cinema5bms struct { | |||
Id int `json:"id"` | |||
Name string `json:"name"` | |||
Grade string `json:"grade"` | |||
Duration string `json:"duration"` | |||
PublishDate string `json:"publish_date"` | |||
Director string `json:"director"` | |||
Cast string `json:"cast"` | |||
Intro string `json:"intro"` | |||
VersionTypes string `json:"version_types"` | |||
Language string `json:"language"` | |||
FilmTypes string `json:"film_types"` | |||
Pic string `json:"pic"` | |||
Moviearea string `json:"moviearea"` | |||
Actor string `json:"actor"` | |||
Stills string `json:"stills"` | |||
IsSession int `json:"is_session"` | |||
} | |||
type Cinema5bmsOrder struct { | |||
AddTime string `json:"add_time"` | |||
PayTime string `json:"pay_time"` | |||
RefundTime string `json:"refund_time"` | |||
OrderSn string `json:"order_sn"` | |||
FilmName string `json:"film_name"` | |||
CinemaName string `json:"cinema_name"` | |||
OrderAmount string `json:"order_amount"` | |||
OrderStatus string `json:"order_status"` | |||
Commission string `json:"commission"` | |||
MediumId string `json:"medium_id"` | |||
CustomParams string `json:"custom_params"` | |||
Nsource string `json:"nsource"` | |||
} | |||
type Cinema5bmsData struct { | |||
Id int `json:"id"` | |||
IsHot int `json:"is_hot"` | |||
Appid string `json:"appid"` | |||
FirstCate string `json:"first_cate"` | |||
Type string `json:"type"` | |||
Title string `json:"title"` | |||
Description string `json:"description"` | |||
SecondCate string `json:"second_cate"` | |||
Episode int `json:"episode"` | |||
Platform string `json:"platform"` | |||
UpdateTime int `json:"update_time"` | |||
ImageUrl string `json:"image_url"` | |||
IsEnd int `json:"is_end"` | |||
PayEpisode int `json:"pay_episode"` | |||
Material string `json:"material"` | |||
OnlineTime string `json:"online_time"` | |||
Time int `json:"time"` | |||
IsClose int `json:"is_close"` | |||
Key string `json:"key"` | |||
} | |||
type Bihai struct { | |||
Id int `json:"id"` | |||
Name string `json:"name"` | |||
Description string `json:"description"` | |||
ImgUrl string `json:"img_url"` | |||
VideoNum int `json:"video_num"` | |||
Price int `json:"price"` | |||
ChargeNum int `json:"charge_num"` | |||
TaskStatus int `json:"task_status"` | |||
AppId string `json:"app_id"` | |||
AppName string `json:"app_name"` | |||
KsAppId string `json:"ks_app_id"` | |||
} |
@@ -3,6 +3,10 @@ package md | |||
const ( | |||
ZhimengCronTikTokTaskRelate = "zhimeng_cron_tik_tok_relate" | |||
ZhimengCronTikTokCsjp = "zhimeng_cron_tik_tok_csjp" | |||
ZhimengCronCinema5bms = "zhimeng_cron_cinema5bms" | |||
ZhimengCronPLayletBihaiOrder = "zhimeng_cron_playlet_bihai_order" | |||
ZhimengCronCinema5bmsOrder = "zhimeng_cron_cinema5bms_order" | |||
ZhimengCronCinema5bmsYesterOrder = "zhimeng_cron_cinema5bms_yester_order" | |||
ZhimengCronTikTokCsjpActivity = "zhimeng_cron_tik_tok_csjp_activity" | |||
ZhimengCronTikTokTask = "zhimeng_cron_tik_tok_task" //短剧订单 | |||
ZhimengCronTikTokTaskMoney = "zhimeng_cron_tik_tok_task_money" //短剧订单 | |||
@@ -1,5 +1,8 @@ | |||
package md | |||
var SourceCate = map[string]string{"tt99fdef4006c36ff001": "dianzhong", "tt38e94e54a7d70c4601": "bihai"} | |||
var SourceBili = map[string]string{"tt99fdef4006c36ff001": "15", "tt38e94e54a7d70c4601": "20"} | |||
type TikTokTaskDetail struct { | |||
AnchorTitle string `json:"anchor_title"` | |||
Appid string `json:"appid"` | |||
@@ -0,0 +1,79 @@ | |||
package svc | |||
import ( | |||
offical "applet/app/db/official" | |||
md2 "applet/app/es/md" | |||
"applet/app/task/md" | |||
"applet/app/utils" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/cinema_5bms" | |||
"encoding/json" | |||
"fmt" | |||
"github.com/syyongx/php2go" | |||
"github.com/tidwall/gjson" | |||
"time" | |||
) | |||
func Cinema5bms() { | |||
cinema5bmsAppid := offical.SysCfgByKeyStr("cinema5bms_appid") | |||
cinema5bmsAppsecret := offical.SysCfgByKeyStr("cinema5bms_appSecret") | |||
page := 1 | |||
//es.CreateIndexIfNotExists(md2.ZhiosNewVideo, md2.ZhiosNewVideoEsMapping) | |||
for { | |||
args := map[string]string{ | |||
"app_id": cinema5bmsAppid, | |||
"p": utils.IntToStr(page), | |||
"limit": "200", | |||
} | |||
cinema, _ := cinema_5bms.GetCinema("open/getNewFilmList", cinema5bmsAppsecret, args) | |||
data := make([]md.Cinema5bms, 0) | |||
json.Unmarshal([]byte(gjson.Get(cinema, "data.list").String()), &data) | |||
for _, v := range data { | |||
tmp := md.Cinema5bmsData{ | |||
Id: v.Id, | |||
IsHot: 0, | |||
Appid: cinema5bmsAppid, | |||
FirstCate: "cinema", | |||
Type: "5bms", | |||
Title: v.Name, | |||
Description: v.Intro, | |||
SecondCate: v.FilmTypes, | |||
Episode: 0, | |||
Platform: "tikTok,kuaishou", | |||
UpdateTime: int(time.Now().Unix()), | |||
ImageUrl: v.Pic, | |||
IsEnd: 0, | |||
PayEpisode: 0, | |||
Material: "", | |||
OnlineTime: v.PublishDate, | |||
Time: int(time.Now().Unix()), | |||
} | |||
uniqueId := php2go.Md5(tmp.Appid + "_" + tmp.Type + "_" + tmp.FirstCate + "_" + utils.IntToStr(tmp.Id)) | |||
tmp.Key = uniqueId | |||
fmt.Println(uniqueId) | |||
commAddNew(uniqueId, tmp) | |||
} | |||
if len(data) == 0 || len(data) < 200 { | |||
break | |||
} | |||
page++ | |||
} | |||
} | |||
func commAddNew(uniqueId string, tmp md.Cinema5bmsData) { | |||
doc, _ := es.FirstDoc(md2.ZhiosNewVideo, uniqueId) | |||
if doc == nil { | |||
createDocRet, err := es.CreateDoc(md2.ZhiosNewVideo, uniqueId, tmp) | |||
if err != nil { | |||
return | |||
} | |||
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet) | |||
} else { | |||
createDocRet, err := es.UpdateDoc(md2.ZhiosNewVideo, uniqueId, tmp) | |||
if err != nil { | |||
return | |||
} | |||
fmt.Printf("CreateDoc ==> %+v \n\n", createDocRet) | |||
} | |||
} |
@@ -0,0 +1,166 @@ | |||
package svc | |||
import ( | |||
"applet/app/db" | |||
"applet/app/db/model" | |||
offical "applet/app/db/official" | |||
"applet/app/task/md" | |||
"applet/app/utils" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/cinema_5bms" | |||
"encoding/json" | |||
"github.com/tidwall/gjson" | |||
"strings" | |||
"time" | |||
) | |||
func Cinema5bmsOrder() { | |||
cinema5bmsAppid := offical.SysCfgByKeyStr("cinema5bms_appid") | |||
cinema5bmsAppsecret := offical.SysCfgByKeyStr("cinema5bms_appSecret") | |||
uid := "0" | |||
// 获取上次获取订单时候的时间戳 | |||
pvdTimeKey := "cinema5bms_order_time" | |||
now := time.Now().Unix() | |||
past := GetRunTime(uid, pvdTimeKey, "短剧获取订单时间") | |||
var ( | |||
beginTime int64 = 0 | |||
endTime int64 = 0 | |||
pageNo int = 1 | |||
pageSize int = 50 | |||
) | |||
//怕时间不是走最新的 | |||
leave := now - past | |||
if leave > 500 { | |||
leave = 0 | |||
} | |||
var eveTime int64 = 3600 | |||
past = past + leave | |||
beginTime = past - eveTime | |||
endTime = past | |||
if endTime > now { | |||
endTime = now | |||
} | |||
for { | |||
// 分配堆内存 | |||
time.Sleep(time.Microsecond * 500) // 等待500毫秒 | |||
//获取订单 | |||
arg := map[string]string{ | |||
"app_id": cinema5bmsAppid, | |||
"pay_start_date": time.Unix(beginTime, 0).Format("2006-01-02 15:04:05"), | |||
"pay_end_date": time.Unix(endTime, 0).Format("2006-01-02 15:04:05"), | |||
"limit": utils.IntToStr(pageSize), | |||
"p": utils.IntToStr(pageNo), | |||
} | |||
count := GetNewVideoOrder(uid, cinema5bmsAppsecret, arg) | |||
if count == 0 { | |||
goto ChkArg | |||
} | |||
if count == pageSize { | |||
pageNo++ | |||
continue | |||
} | |||
ChkArg: | |||
// 查询完后重置时间, 最后查询时间 | |||
if endTime < now { | |||
pageNo = 1 | |||
SetRunTime(uid, pvdTimeKey, utils.TimeToStr(endTime)) | |||
beginTime = endTime | |||
endTime = endTime + eveTime | |||
if endTime > now { | |||
endTime = now | |||
} | |||
continue | |||
} | |||
break | |||
} | |||
// 更新最后供应商执行订单时间 | |||
SetRunTime(uid, pvdTimeKey, utils.TimeToStr(now)) | |||
} | |||
func Cinema5bmsOrderDate() { | |||
cinema5bmsAppid := offical.SysCfgByKeyStr("cinema5bms_appid") | |||
cinema5bmsAppsecret := offical.SysCfgByKeyStr("cinema5bms_appSecret") | |||
yesterday := utils.GetTimeRange("yesterday") | |||
var ( | |||
pageNo int = 1 | |||
pageSize int = 50 | |||
) | |||
uid := "0" | |||
for { | |||
// 分配堆内存 | |||
time.Sleep(time.Microsecond * 500) // 等待500毫秒 | |||
//获取订单 | |||
arg := map[string]string{ | |||
"app_id": cinema5bmsAppid, | |||
"show_time": time.Unix(yesterday["start"], 0).Format("2006-01-02"), | |||
"limit": utils.IntToStr(pageSize), | |||
"p": utils.IntToStr(pageNo), | |||
} | |||
count := GetNewVideoOrder(uid, cinema5bmsAppsecret, arg) | |||
if count == 0 { | |||
break | |||
} | |||
if count == pageSize { | |||
pageNo++ | |||
continue | |||
} | |||
} | |||
} | |||
func GetNewVideoOrder(uids string, cinema5bmsAppsecret string, arg map[string]string) int { | |||
cinema, _ := cinema_5bms.GetCinema("open/getOrderList", cinema5bmsAppsecret, arg) | |||
data := make([]md.Cinema5bmsOrder, 0) | |||
json.Unmarshal([]byte(gjson.Get(cinema, "data.list").String()), &data) | |||
statusMap := map[string]string{ | |||
"等待核销": "订单付款", | |||
"核销成功": "订单完成", | |||
"核销失败": "订单失败", | |||
} | |||
for _, v := range data { | |||
sourceIdArr := strings.Split(v.CustomParams, "_") | |||
mid := "" | |||
uid := "" | |||
if len(sourceIdArr) == 2 { | |||
mid = sourceIdArr[0] | |||
uid = sourceIdArr[1] | |||
} | |||
if mid == "" || uid == "" { | |||
continue | |||
} | |||
Channel := "douyin" | |||
if v.Nsource == "2" { | |||
Channel = "kuaishou" | |||
} | |||
money := v.OrderAmount | |||
commission := utils.StrToFloat64(v.OrderAmount) * (10.0 / 100) | |||
var tmp = model.PlayletSaleOrder{ | |||
Uid: mid, | |||
SubUid: utils.StrToInt(uid), | |||
Data: utils.SerializeStr(v), | |||
Oid: v.OrderSn, | |||
Amount: money, | |||
Commission: utils.Float64ToStr(commission), | |||
CreateTime: utils.TimeParseStd(v.PayTime), | |||
UpdateTime: time.Now(), | |||
Title: v.CinemaName + "-" + v.FilmName, | |||
VideoType: Channel, | |||
PlatformType: "5bms", | |||
GoodsType: "playlet", | |||
OrdType: "cinema", | |||
ExtendUid: uids, | |||
} | |||
playletSaleOrderDb := db.PlayletSaleOrderDb{} | |||
playletSaleOrderDb.Set() | |||
ord := playletSaleOrderDb.GetPlayletVideoOrderByOid(v.OrderSn, tmp.OrdType) | |||
tmp.Status = statusMap[v.OrderStatus] | |||
if v.RefundTime != "" { | |||
tmp.RefundTime = utils.TimeParseStd(v.RefundTime) | |||
} | |||
if ord != nil { | |||
playletSaleOrderDb.PlayletVideoOrderUpdate(ord.Id, &tmp) | |||
} else { | |||
tmp.CustomOid = utils.OrderUUID(tmp.SubUid) | |||
playletSaleOrderDb.PlayletVideoOrderInsert(&tmp) | |||
} | |||
} | |||
return len(data) | |||
} |
@@ -0,0 +1,5 @@ | |||
package svc | |||
func PlayletBihai() { | |||
} |
@@ -0,0 +1,156 @@ | |||
package svc | |||
import ( | |||
"applet/app/db" | |||
"applet/app/db/model" | |||
offical "applet/app/db/official" | |||
"applet/app/task/md" | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/playlet_bihai" | |||
"encoding/json" | |||
"github.com/tidwall/gjson" | |||
"strings" | |||
"time" | |||
) | |||
func PlayletBihaiOrder() { | |||
bihaiAppId := offical.SysCfgByKeyStr("bihai_app_id") | |||
key := "bihai_token_" + bihaiAppId | |||
bihaiAppSecret := offical.SysCfgByKeyStr("bihai_app_secret") | |||
getString, err := cache.GetString(key) | |||
if getString == "" || err != nil { | |||
args := map[string]string{ | |||
"app_id": bihaiAppId, | |||
"app_secret": bihaiAppSecret, | |||
} | |||
login, _ := playlet_bihai.Login(args) | |||
token := gjson.Get(login, "data.access_token").String() | |||
expiresIn := gjson.Get(login, "data.expires_in").Int() | |||
if token != "" { | |||
cache.SetEx(key, token, int(expiresIn)) | |||
} | |||
getString = token | |||
} | |||
if getString == "" { | |||
return | |||
} | |||
uid := "0" | |||
// 获取上次获取订单时候的时间戳 | |||
pvdTimeKey := "bihai_order_time" | |||
now := time.Now().Unix() | |||
past := GetRunTime(uid, pvdTimeKey, "短剧获取订单时间") | |||
var ( | |||
beginTime int64 = 0 | |||
endTime int64 = 0 | |||
pageNo int = 1 | |||
pageSize int = 100 | |||
) | |||
//怕时间不是走最新的 | |||
leave := now - past | |||
if leave > 500 { | |||
leave = 0 | |||
} | |||
var eveTime int64 = 3600 | |||
past = past + leave | |||
beginTime = past - eveTime | |||
endTime = past | |||
if endTime > now { | |||
endTime = now | |||
} | |||
nextId := "0" | |||
for { | |||
// 分配堆内存 | |||
time.Sleep(time.Microsecond * 500) // 等待500毫秒 | |||
//获取订单 | |||
arg := map[string]string{ | |||
"start_at": time.Unix(beginTime, 0).Format("2006-01-02 15:04:05"), | |||
"end_at": time.Unix(endTime, 0).Format("2006-01-02 15:04:05"), | |||
"page_size": utils.IntToStr(pageSize), | |||
"next_id": nextId, | |||
} | |||
link, _ := playlet_bihai.OrderList(getString, arg) | |||
var order md.BihaiOrder | |||
err := json.Unmarshal([]byte(gjson.Get(link, "data").String()), &order) | |||
if err != nil { | |||
break | |||
} | |||
statusMap := map[string]string{ | |||
"1": "订单付款", | |||
"2": "订单失败", | |||
} | |||
for _, v := range order.List { | |||
if utils.StrToInt(v.Status) < 1 { | |||
continue | |||
} | |||
sourceIdArr := strings.Split(v.Ext.QwExt, "_") | |||
mid := "" | |||
uid1 := "" | |||
if len(sourceIdArr) == 2 { | |||
mid = sourceIdArr[0] | |||
uid1 = sourceIdArr[1] | |||
} | |||
if mid == "" || uid1 == "" { | |||
continue | |||
} | |||
Channel := "douyin" | |||
if v.MarketId == "2" { | |||
Channel = "kuaishou" | |||
} | |||
money := utils.Float64ToStr(utils.StrToFloat64(v.Price) / 100) | |||
commission := utils.StrToFloat64(money) * (80.0 / 100) | |||
var tmp = model.PlayletSaleOrder{ | |||
Uid: mid, | |||
SubUid: utils.StrToInt(uid1), | |||
Data: utils.SerializeStr(v), | |||
Oid: v.OrderId, | |||
Amount: money, | |||
Commission: utils.Float64ToStr(commission), | |||
CreateTime: utils.TimeParseStd(v.CreatedAt), | |||
UpdateTime: time.Now(), | |||
Title: "碧海剧场", | |||
VideoType: Channel, | |||
PlatformType: "bihai", | |||
GoodsType: "playlet", | |||
OrdType: "video", | |||
ExtendUid: uid, | |||
} | |||
playletSaleOrderDb := db.PlayletSaleOrderDb{} | |||
playletSaleOrderDb.Set() | |||
ord := playletSaleOrderDb.GetPlayletVideoOrderByOid(v.OrderId, tmp.OrdType) | |||
tmp.Status = statusMap[v.Status] | |||
if ord != nil { | |||
playletSaleOrderDb.PlayletVideoOrderUpdate(ord.Id, &tmp) | |||
} else { | |||
tmp.CustomOid = utils.OrderUUID(tmp.SubUid) | |||
playletSaleOrderDb.PlayletVideoOrderInsert(&tmp) | |||
} | |||
} | |||
if order.HasMore == false { | |||
nextId = "0" | |||
goto ChkArg | |||
} | |||
if len(order.List) == pageSize { | |||
nextId = utils.IntToStr(order.NextId) | |||
pageNo++ | |||
continue | |||
} | |||
ChkArg: | |||
// 查询完后重置时间, 最后查询时间 | |||
if endTime < now { | |||
nextId = "0" | |||
pageNo = 1 | |||
SetRunTime(uid, pvdTimeKey, utils.TimeToStr(endTime)) | |||
beginTime = endTime | |||
endTime = endTime + eveTime | |||
if endTime > now { | |||
endTime = now | |||
} | |||
continue | |||
} | |||
break | |||
} | |||
// 更新最后供应商执行订单时间 | |||
SetRunTime(uid, pvdTimeKey, utils.TimeToStr(now)) | |||
} |
@@ -71,6 +71,7 @@ func TikTokTaskMoney(types string) { | |||
Do(context.Background()) | |||
fmt.Println(result) | |||
fmt.Println(err) | |||
appId := "" | |||
if result != nil && len(result.Hits.Hits) > 0 { | |||
for _, hit := range result.Hits.Hits { | |||
if hit == nil { | |||
@@ -81,18 +82,24 @@ func TikTokTaskMoney(types string) { | |||
if marErr == nil { | |||
err := json.Unmarshal(jsonByte, &tmps) | |||
if err == nil { | |||
appId = tmps.Appid | |||
bili := float64(tmps.PaymentAllocateRatio) / 10000 * (10.0 / 11.0) * 1000 | |||
TalentProfit1D = float64(int(bili)) / 10 | |||
} | |||
} | |||
} | |||
} | |||
if appId == "" { | |||
continue | |||
} | |||
discount := float64(v.BillingGMV1D)/100 - float64(v.BillingRefundGMV1D)/100 | |||
if discount < 0 { | |||
discount = 0 | |||
} | |||
talentBili := float64(int(discount*(TalentProfit1D/100)*100)) / 100 | |||
platformBili := php2go.Round(discount*(15.0/100), 2) | |||
//每个平台不一样的比例 | |||
sourceBili := utils.StrToFloat64(md.SourceBili[appId]) | |||
platformBili := php2go.Round(discount*(sourceBili/100), 2) | |||
commission := discount - talentBili - platformBili | |||
fee := discount - commission | |||
oid := "douyin" + zhios_third_party_utils.Int64ToStr(v.VideoId) + v.AgentID + v.DouyinID + date | |||
@@ -120,7 +127,7 @@ func TikTokTaskMoney(types string) { | |||
UpdateTime: time.Now(), | |||
Title: v.VideoTitle, | |||
VideoType: "douyin", | |||
PlatformType: "dianzhong", | |||
PlatformType: md.SourceCate[appId], | |||
GoodsType: "playlet", | |||
OrdType: "video", | |||
ExtendUid: v.DouyinID + "_" + v.AgentID, | |||
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskCinema5bms() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.Cinema5bms() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskCinema5bmsOrder() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.Cinema5bmsOrder() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskCinema5bmsYesterOrder() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.Cinema5bmsOrderDate() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskPlayletBihai() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.PlayletBihai() | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
) | |||
// | |||
func taskPlayletBihaiOrder() { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.PlayletBihaiOrder() | |||
<-ch | |||
} |
@@ -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.20240131014841-ab7390becddd | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240204013130-5c8d80b56d52 | |||
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 | |||