Skip to content

Commit

Permalink
Merge branch 'release/v1.30.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Dec 26, 2024
2 parents 5e7d78d + 203150a commit 8272c57
Show file tree
Hide file tree
Showing 13 changed files with 476 additions and 1 deletion.
5 changes: 5 additions & 0 deletions marketing-api/OCEANENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
- 获取纵横组织下所有主体信息 [ businessplatform.CompanyInfoGet(clt *core.SDKClient, accessToken string, req *businessplatform.CompanyInfoGetRequest) (*businessplatform.CompanyInfoGetData, error) ]
- 获取主体下的账户列表 [ businessplatform.CompanyAccountGet(clt *core.SDKClient, accessToken string, req *businessplatform.CompanyAccountGetRequest) (*businessplatform.CompanyAccountGetData, error) ]
- 资金和流水管理 (api)
- 工作台转账-获取可转列表 [ customercenter.CanTransferTargetList(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferTargetListRequest) (*customercenter.CanTransferTargetListResult, error) ]
- 工作台转账-获取最大可转余额 [ customercenter.CanTransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferBalanceGetRequest) ([]customercenter.CanTransferDetail, error) ]
- 工作台转账-查询账户转账余额 [ customercenter.TransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferBalanceGetRequest) ([]customercenter.TargetAmountDetail, error) ]
- 工作台转账-发起转账 [ customercenter.TransferCreate(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferCreateRequest) (string, error) ]
- 工作台转账-查询转账单信息 [ customercenter.TransferDetailGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferDetailGetRequest) (*customercenter.TransferDetail, error) ]
- 查询账号余额 [ advertiser.FundGet(clt *core.SDKClient, accessToken string, advertiserID uint64) (*advertiser.FundGetResult, error) ]
- 批量查询账户余额 [ advertiser.AccountFundGet(clt *core.SDKClient, accessToken string, req *advertiser.AccountFundGetRequest) ([]advertiser.AccountFund, error) ]
- 查询账号日流水 [ advertiser.FundDailyStat(clt *core.SDKClient, accessToken string, req *advertiser.FundDailyStatRequest) (*advertiser.FundDailyStatResponseData, error) ]
Expand Down
18 changes: 18 additions & 0 deletions marketing-api/api/customercenter/can_transfer_balance_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package customercenter

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/customercenter"
)

// CanTransferBalanceGet 工作台转账-获取最大可转余额
// 查询转出方与转入方之间最大可转金额,接口内已自动扣除需要预留的竞价消耗保证金,支持查询1:N转账的最大可转金额
func CanTransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferBalanceGetRequest) ([]customercenter.CanTransferDetail, error) {
var resp customercenter.CanTransferBalanceGetResponse
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/can_transfer_balance/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.CanTransferDetailList, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/customercenter/can_transfer_target_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package customercenter

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/customercenter"
)

// CanTransferTargetList 工作台转账-获取可转列表
// 查询当前账户(锚定账户)可以互相转账的账户列表
func CanTransferTargetList(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.CanTransferTargetListRequest) (*customercenter.CanTransferTargetListResult, error) {
var resp customercenter.CanTransferTargetListResponse
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/can_transfer_target/list/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/customercenter/transfer_balance_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package customercenter

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/customercenter"
)

// TransferBalanceGet 工作台转账-查询账户转账余额
// 查询账户自身转账余额、作为转出方需要预留的竞价消耗保证金
func TransferBalanceGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferBalanceGetRequest) ([]customercenter.TargetAmountDetail, error) {
var resp customercenter.TransferBalanceGetResponse
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/transfer_balance/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data.TargetAmountDetailList, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/customercenter/transfer_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package customercenter

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/customercenter"
)

// TransferCreate 工作台转账-发起转账
// 发起转账,支持1:N转账、不停投转账
func TransferCreate(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferCreateRequest) (string, error) {
var resp customercenter.TransferCreateResponse
if err := clt.PostAPI(ctx, "v3.0/cg_transfer/transfer/create/", req, &resp, accessToken); err != nil {
return "", err
}
return resp.Data.TransferSerial, nil
}
18 changes: 18 additions & 0 deletions marketing-api/api/customercenter/transfer_detail_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package customercenter

import (
"context"

"github.com/bububa/oceanengine/marketing-api/core"
"github.com/bububa/oceanengine/marketing-api/model/customercenter"
)

// TransferDetailGet 工作台转账-查询转账单信息
// 转账单信息,包括状态、双方账户、转账金额
func TransferDetailGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *customercenter.TransferDetailGetRequest) (*customercenter.TransferDetail, error) {
var resp customercenter.TransferDetailGetResponse
if err := clt.GetAPI(ctx, "v3.0/cg_transfer/transfer_detail/get/", req, &resp, accessToken); err != nil {
return nil, err
}
return resp.Data, nil
}
8 changes: 8 additions & 0 deletions marketing-api/enum/capital_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const (
CapitalType_CREDIT_BRAND CapitalType = "CREDIT_BRAND"
// CaptialType_CREDIT_GENERAL 授信通用
CaptialType_CREDIT_GENERAL CapitalType = "CREDIT_GENERAL"
// CapitalType_GRANT_COMMON 信息流赠款
CapitalType_GRANT_COMMON CapitalType = "GRANT_COMMON"
// CapitalType_GRANT_DEFAULT 通用赠款
CapitalType_GRANT_DEFAULT CapitalType = "GRANT_DEFAULT"
// CapitalType_GRANT_SEARCH 搜索赠款
CapitalType_GRANT_SEARCH CapitalType = "GRANT_SEARCH"
// CapitalType_GRANT_UNION 穿山甲赠款
CapitalType_GRANT_UNION CapitalType = "GRANT_UNION"
// CaptialType_PREPAY_BIDDING 预付竞价
CaptialType_PREPAY_BIDDING CapitalType = "PREPAY_BIDDING"
// CaptialType_PREPAY_BRAND 预付品牌
Expand Down
88 changes: 88 additions & 0 deletions marketing-api/model/customercenter/can_transfer_balance_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package customercenter

import (
"strconv"

"github.com/bububa/oceanengine/marketing-api/enum"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// CanTransferBalanceGetRequest 工作台转账-获取最大可转余额 API Request
type CanTransferBalanceGetRequest struct {
// OrganizationID 组织id
OrganizationID uint64 `json:"organization_id,omitempty"`
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐
BizRequestNo string `json:"biz_request_no,omitempty"`
// OpponentTargetID 锚定账户id,查询该账户的可转账账户列表
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"`
// TargetIDs 目标账户id列表,1:N的N,最多支持100个
TargetIDs []uint64 `json:"target_ids,omitempty"`
// TransferDirection 转账方向,以可转列表视角确定 可选值:
// TRANSFER_IN 转入
// TRANSFER_OUT 转出
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"`
// Platform 业务线 可选值:
// AD 广告
// BENDITUI 本地推
Platform string `json:"platform,omitempty"`
}

// Encode implements GetRequest interface
func (r CanTransferBalanceGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10))
values.Set("biz_request_no", r.BizRequestNo)
values.Set("opponent_target_id", strconv.FormatUint(r.OpponentTargetID, 10))
values.Set("target_ids", string(util.JSONMarshal(r.TargetIDs)))
values.Set("transfer_direction", string(r.TransferDirection))
values.Set("platform", r.Platform)
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// CanTransferBalanceGetResponse 工作台转账-获取最大可转余额 API Response
type CanTransferBalanceGetResponse struct {
model.BaseResponse
Data struct {
// CanTransferDetailList 可转余额信息列表
CanTransferDetailList []CanTransferDetail `json:"can_transfer_detail_list,omitempty"`
} `json:"data,omitempty"`
}

// CanTransferDetail 可转余额信息
type CanTransferDetail struct {
// RemitterTargetID 转出方账户id
RemitterTargetID uint64 `json:"remitter_target_id,omitempty"`
// PayeeTransferAmountDetailList 转入方可转余额信息列表
PayeeTransferAmountDetailList []PayeeTransferAmountDetail `json:"payee_transfer_amount_detail_list,omitempty"`
// CapitalDetailList 转出方可转资金列表
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"`
}

// PayeeTransferAmountDetail 转入方可转余额信息
type PayeeTransferAmountDetail struct {
// PayeeTargetID 转入方账户id
PayeeTargetID uint64 `json:"payee_target_id,omitempty"`
// CapitalDetailList 转入方可转资金列表
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"`
}

// CapitalDetail 转入方可转资金
type CapitalDetail struct {
// CapitalType 转入方可转资金类型 可选值:
// CREDIT_BIDDING 授信竞价
// CREDIT_BRAND 授信品牌
// CREDIT_GENERAL 授信通用
// GRANT_COMMON 信息流赠款
// GRANT_DEFAULT 通用赠款
// GRANT_SEARCH 搜索赠款
// GRANT_UNION 穿山甲赠款
// PREPAY_BIDDING 预付竞价
// PREPAY_BRAND 预付品牌
// PREPAY_GENERAL 预付通用
CapitalType enum.CapitalType `json:"capital_type,omitempty"`
// TransferBalance 转入方可转资金余额(单位:分)
TrainsferBalance int64 `json:"transfer_balance,omitempty"`
}
71 changes: 71 additions & 0 deletions marketing-api/model/customercenter/can_transfer_target_list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package customercenter

import (
"strconv"

"github.com/bububa/oceanengine/marketing-api/enum"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// CanTransferTargetListRequest 工作台转账-获取可转列表 API Request
type CanTransferTargetListRequest struct {
// OrganizationID 组织id
OrganizationID uint64 `json:"organization_id,omitempty"`
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐
BizRequestNo string `json:"biz_request_no,omitempty"`
// OpponentTargetID 锚定账户id,查询该账户的可转账账户列表
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"`
// TransferDirection 转账方向,以可转列表视角确定 可选值:
// TRANSFER_IN 转入
// TRANSFER_OUT 转出
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"`
// Platform 业务线 可选值:
// AD 广告
// BENDITUI 本地推
Platform string `json:"platform,omitempty"`
// Page 页码,从1开始
Page int `json:"page,omitempty"`
// PageSize 每页最多100
PageSize int `json:"page_size,omitempty"`
}

// Encode implements GetRequest interface
func (r CanTransferTargetListRequest) Encode() string {
values := util.GetUrlValues()
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10))
values.Set("biz_request_no", r.BizRequestNo)
values.Set("opponent_target_id", strconv.FormatUint(r.OpponentTargetID, 10))
values.Set("transfer_direction", string(r.TransferDirection))
values.Set("platform", r.Platform)
if r.Page > 0 {
values.Set("page", strconv.Itoa(r.Page))
}
if r.PageSize > 0 {
values.Set("page_size", strconv.Itoa(r.PageSize))
}
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// CanTransferTargetListResponse 工作台转账-获取可转列表 API Response
type CanTransferTargetListResponse struct {
model.BaseResponse
Data *CanTransferTargetListResult `json:"data,omitempty"`
}

type CanTransferTargetListResult struct {
// PageInfo 分页信息
PageInfo *model.PageInfo `json:"page_info,omitempty"`
// CanTransferTargetList 可转账户列表
CanTransferTargetList []TransferTarget `json:"can_transfer_target_list,omitempty"`
}

// TransferTarget 可转账户
type TransferTarget struct {
// TargetID 可转账户id
TargetID uint64 `json:"target_id,omitempty"`
// TransferCaptialDetailList 锚定账户与目标账户转账资金列表
TransferCaptialDetailList []CapitalDetail `json:"transfer_captial_detail_list,omitempty"`
}
2 changes: 1 addition & 1 deletion marketing-api/model/customercenter/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Package customercenter 管家账号相关API models
// Package customercenter 管家账号(工作台)相关API models
package customercenter
55 changes: 55 additions & 0 deletions marketing-api/model/customercenter/transfer_balance_get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package customercenter

import (
"strconv"

"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// TransferBalanceGetRequest 工作台转账-查询账户转账余额 API Request
type TransferBalanceGetRequest struct {
// OrganizationID 组织id
OrganizationID uint64 `json:"organization_id,omitempty"`
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐
BizRequestNo string `json:"biz_request_no,omitempty"`
// TargetIDList 查询账户id列表(限制长度100)
TargetIDList []uint64 `json:"target_id_list,omitempty"`
// Platform 业务线 可选值:
// AD 广告
// BENDITUI 本地推
Platform string `json:"platform,omitempty"`
}

// Encode implements GetRequest interface
func (r TransferBalanceGetRequest) Encode() string {
values := util.GetUrlValues()
values.Set("organization_id", strconv.FormatUint(r.OrganizationID, 10))
values.Set("biz_request_no", r.BizRequestNo)
values.Set("target_id_list", string(util.JSONMarshal(r.TargetIDList)))
values.Set("platform", r.Platform)
ret := values.Encode()
util.PutUrlValues(values)
return ret
}

// TransferBalanceGetResponse 工作台转账-查询账户转账余额 API Response
type TransferBalanceGetResponse struct {
model.BaseResponse
Data struct {
// TargetAmountDetailList 账户金额列表
TargetAmountDetailList []TargetAmountDetail `json:"target_amount_detail_list,omitempty"`
} `json:"data,omitempty"`
}

// TargetAmountDetail 账户金额
type TargetAmountDetail struct {
// TargetID 账户id
TargetID uint64 `json:"target_id,omitempty"`
// CapitalDetailList 可转资金列表
CapitalDetailList []CapitalDetail `json:"capital_detail_list,omitempty"`
// DepositAmount 竞价消耗保证金金额(单位:分)
DepositAmount int64 `json:"deposit_amount,omitempty"`
// TotalTransferAmount 总可转金额(单位:分)
TotalTransferAmount int64 `json:"total_transfer_amount,omitempty"`
}
43 changes: 43 additions & 0 deletions marketing-api/model/customercenter/transfer_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package customercenter

import (
"github.com/bububa/oceanengine/marketing-api/enum"
"github.com/bububa/oceanengine/marketing-api/model"
"github.com/bububa/oceanengine/marketing-api/util"
)

// TransferCreateRequest 工作台转账-发起转账 API Request
type TransferCreateRequest struct {
// OrganizationID 组织id
OrganizationID uint64 `json:"organization_id,omitempty"`
// BizRequestNo 请求id,推荐uuid,方便请求链路对齐
BizRequestNo string `json:"biz_request_no,omitempty"`
// OpponentTargetID 锚定账户id,1:N的1
OpponentTargetID uint64 `json:"opponent_target_id,omitempty"`
// TargetDetailList 目标账户列表,1:N的N,需要列表内账户类型相同,最多支持100个
TargetDetailList []TransferTarget `json:"target_detail_list,omitempty"`
// TransferDirection 转账方向,以目标账户视角确定 可选值:
// TRANSFER_IN 转入
// TRANSFER_OUT 转出
TransferDirection enum.TransferDirection `json:"transfer_direction,omitempty"`
// Remark 备注
Remark string `json:"remark,omitempty"`
// Platform 转账业务线 可选值:
// AD 广告
// BENDITUI 本地推
Platform string `json:"platform,omitempty"`
}

// Encode implements PostRequest interface
func (r TransferCreateRequest) Encode() []byte {
return util.JSONMarshal(r)
}

// TransferCreateResponse 工作台转账-发起转账
type TransferCreateResponse struct {
model.BaseResponse
Data struct {
// TransferSerial 转账单号
TransferSerial string `json:"transfer_serial,omitempty"`
} `json:"data,omitempty"`
}
Loading

0 comments on commit 8272c57

Please sign in to comment.