-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tools/security): 新增支持风控违规积分API和SPI能力,系统化提效风控治理
- Loading branch information
Showing
12 changed files
with
424 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package security 风控违规积分 | ||
package security |
17 changes: 17 additions & 0 deletions
17
marketing-api/api/tools/security/score_disposal_info_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package security | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/security" | ||
) | ||
|
||
// ScoreDisposalInfoGet 查看积分处置详情 | ||
func ScoreDisposalInfoGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *security.ScoreDisposalInfoGetRequest) (*security.ScoreDisposalInfoGetResult, error) { | ||
var resp security.ScoreDisposalInfoGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/security/score_disposal_info/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
17 changes: 17 additions & 0 deletions
17
marketing-api/api/tools/security/score_violation_event_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package security | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/security" | ||
) | ||
|
||
// ScoreViolationEventGet 查询违规积分明细 | ||
func ScoreViolationEventGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *security.ScoreViolationEventGetRequest) (*security.ScoreViolationEventGetResult, error) { | ||
var resp security.ScoreViolationEventGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/security/score_violation_event/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package security | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/core" | ||
"github.com/bububa/oceanengine/marketing-api/model/tools/security" | ||
) | ||
|
||
// ScoreTotalGet 查询账户累计积分 | ||
func ScoreTotalGet(ctx context.Context, clt *core.SDKClient, accessToken string, req *security.ScoreTotalGetRequest) (*security.ScoreTotalGetResult, error) { | ||
var resp security.ScoreTotalGetResponse | ||
if err := clt.GetAPI(ctx, "v3.0/security/score_total/get/", req, &resp, accessToken); err != nil { | ||
return nil, err | ||
} | ||
return resp.Data, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package enum | ||
|
||
// SecurityScoreIllegalType 违规类型 | ||
type SecurityScoreIllegalType string | ||
|
||
const ( | ||
// SecurityScoreIllegalType_GENERAL 一般违规(AD) | ||
SecurityScoreIllegalType_GENERAL SecurityScoreIllegalType = "GENERAL" | ||
// SecurityScoreIllegalType_SERIOUS 严重违规(AD) | ||
SecurityScoreIllegalType_SERIOUS SecurityScoreIllegalType = "SERIOUS" | ||
) |
15 changes: 15 additions & 0 deletions
15
marketing-api/enum/security_score_violation_event_status.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package enum | ||
|
||
// SecurityScoreViolationEventStatus 生效状态 | ||
type SecurityScoreViolationEventStatus string | ||
|
||
const ( | ||
// SecurityScoreViolationEventStatus_APPEAL 已申诉(失效) | ||
SecurityScoreViolationEventStatus_APPEAL SecurityScoreViolationEventStatus = "APPEAL" | ||
// SecurityScoreViolationEventStatus_FAILAPPEAL 申诉失败 | ||
SecurityScoreViolationEventStatus_FAILAPPEAL SecurityScoreViolationEventStatus = "FAILAPPEAL" | ||
// SecurityScoreViolationEventStatus_ONAPPEAL 申诉中 | ||
SecurityScoreViolationEventStatus_ONAPPEAL SecurityScoreViolationEventStatus = "ONAPPEAL" | ||
// SecurityScoreViolationEventStatus_VALID 生效 | ||
SecurityScoreViolationEventStatus_VALID SecurityScoreViolationEventStatus = "VALID" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Package security 风控违规积分 | ||
package security |
99 changes: 99 additions & 0 deletions
99
marketing-api/model/tools/security/score_disposal_info_get.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package security | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/bububa/oceanengine/marketing-api/model" | ||
"github.com/bububa/oceanengine/marketing-api/util" | ||
) | ||
|
||
// ScoreDisposalInfoGetRequest 查看积分处置详情 API Request | ||
type ScoreDisposalInfoGetRequest struct { | ||
// Filtering 过滤条件 | ||
Filtering *ScoreDisposalInfoGetFilter `json:"filtering,omitempty"` | ||
// BusinessLine 业务线,允许值: | ||
// AD 巨量广告 | ||
BusinessLine string `json:"business_line,omitempty"` | ||
// OrderField 排序字段 ,允许值: | ||
// disposal_start_time 处置开始时间 | ||
// disposal_end_time 处置结束时间 | ||
OrderField string `json:"order_field,omitempty"` | ||
// OrderType 排序方式 可选值: | ||
// ASC 升序,默认 | ||
// DESC 降序 | ||
OrderType string `json:"order_type,omitempty"` | ||
// AdvertiserID 广告主ID | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// Page 页数,默认值:1,page范围为[1,99999] | ||
Page int `json:"page,omitempty"` | ||
// PageSize 页面大小,默认值:10,page_size范围为[1,100] | ||
PageSize int `json:"page_size,omitempty"` | ||
} | ||
|
||
type ScoreDisposalInfoGetFilter struct { | ||
// DisposalAction 处置行为,允许值: | ||
// ACCOUNTCLEAR 账号封停+主体限制新开 | ||
// 默认值: ACCOUNTCLEAR | ||
DisposalAction string `json:"disposal_action,omitempty"` | ||
// DisposalStatus 处置状态,允许值: | ||
// DISPOSAL 已处置 | ||
// 默认值: DISPOSAL | ||
DisposalStatus string `json:"disposal_status,omitempty"` | ||
} | ||
|
||
func (r ScoreDisposalInfoGetRequest) Encode() string { | ||
values := util.GetUrlValues() | ||
values.Set("advertiser_id", strconv.FormatUint(r.AdvertiserID, 10)) | ||
values.Set("page", strconv.Itoa(r.Page)) | ||
values.Set("page_size", strconv.Itoa(r.PageSize)) | ||
if r.BusinessLine != "" { | ||
values.Set("business_line", r.BusinessLine) | ||
} | ||
if r.OrderField != "" { | ||
values.Set("order_field", r.OrderField) | ||
} | ||
if r.OrderType != "" { | ||
values.Set("order_type", r.OrderType) | ||
} | ||
if r.Filtering != nil { | ||
values.Set("filtering", string(util.JSONMarshal(r.Filtering))) | ||
} | ||
ret := values.Encode() | ||
util.PutUrlValues(values) | ||
return ret | ||
} | ||
|
||
// ScoreDisposalInfoGetResponse 查看积分处置详情 API Response | ||
type ScoreDisposalInfoGetResponse struct { | ||
Data *ScoreDisposalInfoGetResult `json:"data,omitempty"` | ||
model.BaseResponse | ||
} | ||
|
||
type ScoreDisposalInfoGetResult struct { | ||
// PageInfo 分页信息 | ||
PageInfo *model.PageInfo `json:"page_info,omitempty"` | ||
// DisposalInfoList 处置信息 | ||
DisposalInfoList []DisposalInfo `json:"disposal_info_list,omitempty"` | ||
} | ||
|
||
// DisposalInfo 处置信息 | ||
type DisposalInfo struct { | ||
// DisposalAction 处置行为 | ||
// ACCOUNTCLEAR 账户封停+主体限制新建账户 | ||
DisposalAction string `json:"disposal_action,omitempty"` | ||
// DisposalTerm 处置时长 | ||
DisposalTerm string `json:"disposal_term,omitempty"` | ||
// DisposalStartTime 处置开始时间 | ||
DisposalStartTime string `json:"disposal_start_time,omitempty"` | ||
// DisposalEndTime 处置结束时间 | ||
DisposalEndTime string `json:"disposal_end_time,omitempty"` | ||
// DisposalStatus 处置状态 | ||
// DISPOSAL 已处置 | ||
DisposalStatus string `json:"disposal_status,omitempty"` | ||
// OuterText 对外文案 | ||
OuterText string `json:"outer_text,omitempty"` | ||
// AdvertiserID 广告主id | ||
AdvertiserID uint64 `json:"advertiser_id,omitempty"` | ||
// DisposalScore 落罚分值 | ||
DisposalScore int64 `json:"disposal_score,omitempty"` | ||
} |
Oops, something went wrong.