Skip to content

Commit 80c770f

Browse files
Merge pull request #160 from tencentyun/feature_wqingzhang_5f8244a4
批量图片审核增加 timeout 参数&图片处理参数头部签名
2 parents e178f03 + ae7a17b commit 80c770f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

include/request/auditing_req.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,6 +2784,11 @@ class Conf {
27842784
m_mask = m_mask | 0x00000200u;
27852785
m_freeze = freeze;
27862786
}
2787+
2788+
void SetTimeout(const int timeout) {
2789+
m_mask = m_mask | 0x00000400u;
2790+
m_timeout = timeout;
2791+
}
27872792

27882793
std::string GetBizType() const { return m_biz_type;}
27892794

@@ -2803,6 +2808,8 @@ class Conf {
28032808

28042809
Freeze GetFreeze() const { return m_freeze; }
28052810

2811+
int GetTimeout() const { return m_timeout; }
2812+
28062813
bool HasBizType() const { return (m_mask & 0x00000001u) != 0; }
28072814

28082815
bool HasDetectType() const { return (m_mask & 0x00000002u) != 0;}
@@ -2819,7 +2826,9 @@ class Conf {
28192826

28202827
bool HasAsync() const { return (m_mask & 0x00000080u) != 0; }
28212828

2822-
bool HasFreeze() const { return (m_mask & 0x00000020u) != 0; }
2829+
bool HasFreeze() const { return (m_mask & 0x00000200u) != 0; }
2830+
2831+
bool HasTimeout() const { return (m_mask & 0x00000400u) != 0; }
28232832

28242833
std::string to_string() const {
28252834
std::stringstream ss;
@@ -2831,7 +2840,8 @@ class Conf {
28312840
<< ", detect_content: " << m_detect_content
28322841
<< ", return_highlight_html: " << m_return_highlight_html
28332842
<< ", async: " << m_async
2834-
<< ", freeze: " << m_freeze.to_string();
2843+
<< ", freeze: " << m_freeze.to_string()
2844+
<< ", timeout: " << m_timeout;
28352845
return ss.str();
28362846
}
28372847

@@ -2846,6 +2856,7 @@ class Conf {
28462856
bool m_return_highlight_html; // 网页审核时,是否需要高亮网页耶的违规文本
28472857
int m_async; // 是否异步进行审核,0:同步返回结果,1:异步进行审核。默认值为 0。
28482858
Freeze m_freeze; // 可通过该字段,设置根据审核结果给出的不同分值,对图片进行自动冻结,仅当input中审核的图片为object时有效
2859+
int m_timeout; // 通过该参数可设置请求的超时时间。参数有效值为大于等于0的整数,单位为毫秒,0表示不限制时间,默认值为0
28492860
};
28502861

28512862
class GetImageAuditingReq : public ObjectReq {

src/request/auditing_req.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ bool BatchImageAuditingReq::GenerateRequestBody(std::string* body) const {
152152
rapidxml::node_element, "PornScore",
153153
doc.allocate_string((std::to_string(m_conf.GetFreeze().GetPornSocre()).c_str()))));
154154
}
155+
if (m_conf.HasTimeout()) {
156+
conf_node->append_node(doc.allocate_node(
157+
rapidxml::node_element, "Timeout",
158+
doc.allocate_string((std::to_string(m_conf.GetTimeout()).c_str()))));
159+
}
155160
root_node->append_node(conf_node);
156161

157162
rapidxml::print(std::back_inserter(*body), doc, 0);

0 commit comments

Comments
 (0)