Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1744de3d86 | ||
|
|
6f5e1aa47c | ||
| 2e5667bc4b |
30
services/mkt2/client.go
Normal file
30
services/mkt2/client.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VERSION = "2026-02-03"
|
||||||
|
)
|
||||||
|
|
||||||
|
var HOST = requests.Host{
|
||||||
|
Default: "mkt2-api",
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
sdk.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient() (client *Client, err error) {
|
||||||
|
client = new(Client)
|
||||||
|
err = client.Init()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) MaterialTaskNotify(request *MaterialTaskNotifyRequest) (response *MaterialTaskNotifyResponse, err error) {
|
||||||
|
response = CreateMaterialTaskNotifyResponse()
|
||||||
|
err = c.DoAction(request, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
35
services/mkt2/client_test.go
Normal file
35
services/mkt2/client_test.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestClient_MaterialTaskNotify 测试素材处理任务通知
|
||||||
|
func TestClient_MaterialTaskNotify(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Error("NewClient error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
request := CreateMaterialTaskNotifyRequest(MaterialTaskNotifyParam{
|
||||||
|
TaskType: "resource_to_vdb",
|
||||||
|
TaskId: 223,
|
||||||
|
FileInfo: FileInfo{
|
||||||
|
Md5: "2fcf1306458f2321bccbb0e2ee8a712b",
|
||||||
|
Duration: 0,
|
||||||
|
Size: 14745,
|
||||||
|
Width: 480,
|
||||||
|
Height: 392,
|
||||||
|
Bitrate: 0,
|
||||||
|
Format: "jpg",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
response, err := client.MaterialTaskNotify(request)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("MaterialTaskNotify error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Log("response:", response)
|
||||||
|
fmt.Println("")
|
||||||
|
}
|
||||||
57
services/mkt2/materialtask.go
Normal file
57
services/mkt2/materialtask.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MaterialTaskNotifyParam struct {
|
||||||
|
TaskType string `json:"task_type"`
|
||||||
|
TaskId int64 `json:"task_id"`
|
||||||
|
FileInfo FileInfo `json:"file_info"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// MaterialTaskNotifyRequest 媒资任务通知请求
|
||||||
|
type MaterialTaskNotifyRequest struct {
|
||||||
|
*requests.JsonRequest
|
||||||
|
TaskType string `position:"Json" field:"task_type"`
|
||||||
|
TaskId int64 `position:"Json" field:"task_id"`
|
||||||
|
FileInfo FileInfo `position:"Json" field:"file_info"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// FileInfo 文件信息
|
||||||
|
type FileInfo struct {
|
||||||
|
Md5 string `json:"md5"`
|
||||||
|
Duration float64 `json:"duration"`
|
||||||
|
Size int64 `json:"size"`
|
||||||
|
Width int64 `json:"width"`
|
||||||
|
Height int64 `json:"height"`
|
||||||
|
Bitrate int64 `json:"bitrate"`
|
||||||
|
Format string `json:"format"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MaterialTaskNotifyResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
StatusCode int `json:"status_code"`
|
||||||
|
StatusMsg string `json:"status_msg"`
|
||||||
|
TraceId string `json:"trace_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateMaterialTaskNotifyRequest(param MaterialTaskNotifyParam) (req *MaterialTaskNotifyRequest) {
|
||||||
|
req = &MaterialTaskNotifyRequest{
|
||||||
|
JsonRequest: &requests.JsonRequest{},
|
||||||
|
TaskType: param.TaskType,
|
||||||
|
TaskId: param.TaskId,
|
||||||
|
FileInfo: param.FileInfo,
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/api/cooperation/creativesMaterial/materialTaskNotify")
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateMaterialTaskNotifyResponse() (response *MaterialTaskNotifyResponse) {
|
||||||
|
response = &MaterialTaskNotifyResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
30
services/res-proc/client.go
Normal file
30
services/res-proc/client.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VERSION = "2026-02-03"
|
||||||
|
)
|
||||||
|
|
||||||
|
var HOST = requests.Host{
|
||||||
|
Default: "res-proc",
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
sdk.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient() (client *Client, err error) {
|
||||||
|
client = new(Client)
|
||||||
|
err = client.Init()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) AddTask(request *AddTaskRequest) (response *AddTaskResponse, err error) {
|
||||||
|
response = CreateAddTaskResponse()
|
||||||
|
err = c.DoAction(request, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
31
services/res-proc/client_test.go
Normal file
31
services/res-proc/client_test.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils/random"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestAddResourceToVdbTask 添加素材上传向量库逻辑
|
||||||
|
func TestAddResourceToVdbTask(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Error("NewClient error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
request := CreateResourceToVdbTaskRequest(ResourceToVdbTaskParam{
|
||||||
|
MaxRetry: 0,
|
||||||
|
TraceId: random.StrRandom(10),
|
||||||
|
Payload: ResourceToVdbPayload{
|
||||||
|
ResourceURL: "https://resouce-mkt.gaore.com/material/video/2021-09/01/2124474664246343/6eb5621f8ff2de8f64d4aefa3db4f551.mp4",
|
||||||
|
MD5: "",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
response, err := client.AddTask(request)
|
||||||
|
if err != nil {
|
||||||
|
t.Error("MaterialTaskNotify error:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Log("response:", response)
|
||||||
|
fmt.Println("")
|
||||||
|
}
|
||||||
83
services/res-proc/task.go
Normal file
83
services/res-proc/task.go
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
package mkt2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AddTaskRequest struct {
|
||||||
|
*requests.JsonRequest
|
||||||
|
TaskType string `position:"Json" field:"task_type"`
|
||||||
|
MaxRetry int64 `position:"Json" field:"max_retry"`
|
||||||
|
TraceId string `position:"Json" field:"trace_id"`
|
||||||
|
Payload any `position:"Json" field:"payload"`
|
||||||
|
Extra any `position:"Json" field:"extra"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddTaskResponseData struct {
|
||||||
|
TaskId int64 `json:"task_id"`
|
||||||
|
}
|
||||||
|
type AddTaskResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Data AddTaskResponseData `json:"data"`
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Err string `json:"err"`
|
||||||
|
TraceId string `json:"trace_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddTaskParam struct {
|
||||||
|
TaskType string `position:"Json" field:"task_type"`
|
||||||
|
MaxRetry int64 `position:"Json" field:"max_retry"`
|
||||||
|
TraceId string `position:"Json" field:"trace_id"`
|
||||||
|
Payload any `position:"Json" field:"payload"`
|
||||||
|
Extra any `position:"Json" field:"extra"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateAddTaskRequest(param AddTaskParam) (req *AddTaskRequest) {
|
||||||
|
req = &AddTaskRequest{
|
||||||
|
JsonRequest: &requests.JsonRequest{},
|
||||||
|
TaskType: param.TaskType,
|
||||||
|
MaxRetry: param.MaxRetry,
|
||||||
|
TraceId: param.TraceId,
|
||||||
|
Payload: param.Payload,
|
||||||
|
Extra: param.Extra,
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/api/task/add")
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateAddTaskResponse() (response *AddTaskResponse) {
|
||||||
|
response = &AddTaskResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResourceToVdbPayload
|
||||||
|
//素材上传向量库任务playLod
|
||||||
|
|
||||||
|
const TaskTypeResourceToVdb = "resource_to_vdb"
|
||||||
|
|
||||||
|
type ResourceToVdbPayload struct {
|
||||||
|
ResourceURL string `json:"resource_url"` // 资源 URL
|
||||||
|
MD5 string `json:"md5"` // 资源 MD5
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResourceToVdbTaskParam struct {
|
||||||
|
MaxRetry int64
|
||||||
|
TraceId string
|
||||||
|
Payload ResourceToVdbPayload
|
||||||
|
Extra map[string]any
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateResourceToVdbTaskRequest(param ResourceToVdbTaskParam) (req *AddTaskRequest) {
|
||||||
|
return CreateAddTaskRequest(AddTaskParam{
|
||||||
|
TaskType: TaskTypeResourceToVdb,
|
||||||
|
MaxRetry: param.MaxRetry,
|
||||||
|
TraceId: param.TraceId,
|
||||||
|
Payload: param.Payload,
|
||||||
|
Extra: param.Extra,
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -198,6 +198,7 @@ type UserRegParam struct {
|
|||||||
FromAd int64 `position:"Body" field:"from_ad" default:"0" json:"from_ad"`
|
FromAd int64 `position:"Body" field:"from_ad" default:"0" json:"from_ad"`
|
||||||
FanCode string `position:"Body" field:"fan_code" default:"" json:"fan_code"`
|
FanCode string `position:"Body" field:"fan_code" default:"" json:"fan_code"`
|
||||||
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0" json:"invalid_uuid"`
|
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0" json:"invalid_uuid"`
|
||||||
|
GameAwemeId string `position:"Body" field:"game_aweme_id" default:"0" json:"game_aweme_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserRegRequest struct {
|
type UserRegRequest struct {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user