支付宝新加内容
<p>[TOC]</p>
<h1>2.游戏中心小程序是否已加首咨询</h1>
<h2>2.1接口说明</h2>
<p><div style="background: #9efca6;padding: 12px; border-radius: 8px; color: #000;">✍查询用户是否已经把"游戏中心"小程序设置到支付宝首页宫格位置。</p>
<p><code>checkAddhomepage(function callback)</code>
</div></p>
<h2>2.2参数说明</h2>
<ul>
<li>无需传参</li>
</ul>
<h2>2.3示例代码</h2>
<pre><code class="language-javascript">dyb.checkAddhomepage(function (callback) {
console.log(&#039;是否添加首页:&#039; + JSON.stringify(callback));
});</code></pre>
<h2>2.4接口返回</h2>
<pre><code class="language-javascript">//未添加
是否添加首页:{&quot;code&quot;:0,&quot;msg&quot;:&quot;未添加首页&quot;,&quot;time&quot;:&quot;1752548599&quot;,&quot;data&quot;:null}
//已添加
是否添加首页:{&quot;code&quot;:1,&quot;msg&quot;:&quot;已添加首页&quot;,&quot;time&quot;:&quot;1752548801&quot;,&quot;data&quot;:null}</code></pre>
<h1>3.游戏行为上报</h1>
<h2>3.1接口说明</h2>
<p><div style="background: #9efca6;padding: 12px; border-radius: 8px; color: #000;">✍在用户完成游戏内任务后,游戏使用该接口,实时将用户在游戏内的完成行动同步给游戏中心</p>
<pre><code>createRole(function callback)</code></pre>
<p></div></p>
<h2>3.2参数说明</h2>
<p>|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|action_code |是 |string(64) |用户在游戏中的行动编码<br>【示例值】jjjd_game_signin|
|action_finish_date |是 |date(32) | 用户在游戏中完成该行动的时间<br>【示例值】2022-08-05 23:16:12 |
|action_finish_channel |是 |string | 用户完成行动的渠道<br>【注意事项】取值逻辑:获取小程序启动参数的channel字段,未获取到请默认传other 启动参数链接示例: alipays://platformapi/startapp?appId=202100318xxxxxxx&query=channel%3Dgamecenter。 [获取启动参数接口链接](<a href="https://opendocs.alipay.com/mini/api/getLaunchOptionsSync">https://opendocs.alipay.com/mini/api/getLaunchOptionsSync</a> "获取启动参数接口链接")<br>【示例值】game_xxx |
|out_biz_no |是 |string(128) | 数据的全局唯一标识。用于幂等<br>【示例值】397a679f41dd0fc38d217a082af31f4e |</p>
<h2>3.3示例代码</h2>
<pre><code class="language-javascript">let param = {
action_code: &#039;jjjd_game_signin&#039;,
action_finish_date: &#039;2022-08-05 23:16:12&#039;, //注意这个不要传成时间戳
action_finish_channel: &#039;game_xxx&#039;,
out_biz_no: &#039;397a679f41dd0fc38d217a082af31f4e&#039;
}
dyb.reportGameAction(param, function (callback) {
console.log(&#039;上报游戏行为:&#039; + JSON.stringify(callback));
});</code></pre>
<h2>3.4接口返回</h2>
<pre><code class="language-javascript">//失败
{
&quot;code&quot;: 0,
&quot;msg&quot;: &quot;调用失败&quot;,
&quot;time&quot;: &quot;1752575732&quot;,
&quot;data&quot;: {
&quot;code&quot;: &quot;20000&quot;,
&quot;msg&quot;: &quot;Service Currently Unavailable&quot;,
&quot;sub_code&quot;: &quot;isp.unknow-error&quot;,
&quot;sub_msg&quot;: &quot;系统繁忙&quot;
}
}
//成功
{
&quot;code&quot;: 1,
&quot;msg&quot;: &quot;游戏行为上报成功&quot;,
&quot;time&quot;: &quot;1752549837&quot;,
&quot;data&quot;: null
}</code></pre>
<h1>4.内容风险同步识别</h1>
<h2>3.1接口说明</h2>
<p><div style="background: #9efca6;padding: 12px; border-radius: 8px; color: #000;">✍提供针对垃圾广告、(钓鱼、广告)链接、暴恐政、黄赌毒等内容的风险识别服务</p>
<pre><code>detectRiskContent(function callback)</code></pre>
<p></div></p>
<h2>3.2参数说明</h2>
<p>|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|content_type |是 |int |检测类型<br>1文本,2图片|
|content |是 |string | 用户发表内容<br>【建议】建议对内容中的格式符号、表情符、HTML标签、UBB标签等做过滤,只传递纯文本,以减少误判<br>【注意】当前仅支持单图调用,当前接口仅支持单一内容传入|</p>
<h2>3.3示例代码</h2>
<pre><code class="language-javascript">let param = {
content_type: 1,
content: &#039;希特勒&#039;
}
dyb.detectRiskContent(param, function (callback) {
console.log(&#039;内容安全识别:&#039; + JSON.stringify(callback));
});</code></pre>
<h2>3.4接口返回</h2>
<pre><code class="language-javascript">//失败
{
&quot;code&quot;: 0, //0接口调用失败, 1检查通过, 2检查未通过-拦截, 3检查未通过-人工审核
&quot;msg&quot;: &quot;调用失败&quot;,
&quot;time&quot;: &quot;1752549782&quot;,
&quot;data&quot;: {
&quot;code&quot;: &quot;20000&quot;,
&quot;msg&quot;: &quot;Service Currently Unavailable&quot;,
&quot;sub_code&quot;: &quot;isp.unknow-error&quot;,
&quot;sub_msg&quot;: &quot;系统繁忙&quot;
}
}
//成功
{
&quot;code&quot;: 1, //0接口调用失败, 1检查通过, 2检查未通过-拦截, 3检查未通过-人工审核
&quot;msg&quot;: &quot;检查通过&quot;
}</code></pre>
<h1>13.小游戏游戏道具发放</h1>
<p><div style="background: #EE5837;padding: 12px; border-radius: 8px; color: #000;">⚠️ <strong>注意</strong>
研发需提供礼包发货url交给我方配置才能调用
</div></p>
<h2>13.1接口说明</h2>
<p><div style="background: #9efca6;padding: 12px; border-radius: 8px; color: #000;">✍用户在游戏圈领取礼包后,游戏中心调用小游戏接口,小游戏为用户发放道具</p>
<p></div></p>
<h2>13.2请求示例</h2>
<pre><code class="language-javascript">{
&quot;system&quot;: &quot;ios&quot;,
&quot;gift_type_id&quot;: 1,
&quot;send_time&quot;: &quot;2023-12-03 00:00:00&quot;,
&quot;goods_list&quot;: [
{
&quot;send_count&quot;: 10,
&quot;id&quot;: &quot;1&quot;
}
],
&quot;user_id&quot;: &quot;2088502551000051&quot;,
&quot;open_id&quot;: &quot;074a1CcTG1LelxKe4xQC0zgNdId0nxi95b5lsNpazWYoCo5&quot;,
&quot;gift_id&quot;: 10003,
&quot;test_flag&quot;: false,
&quot;order_id&quot;: &quot;2023042710022830690766934804&quot;
}
</code></pre>
<h2>13.3请求字段说明</h2>
<p>|参数名|类型|说明|
|:---- |:----- |----- |
|order_id |string(64) |【描述】发货订单唯一id,游戏服务端可基于此去重<br>【示例值】2023042710022830690766934804 |
|test_flag |boolean(10) |是否为测试请求,B站道具测试时,此值为true<br>【示例值】false |
|system |string(16) |用户系统<br>【枚举值】<br>安卓: android<br>苹果: ios<br>未知: unknown<br>【示例值】ios |
|gift_type_id |number(1024) |发货礼包类型, 1-每日签到礼包 2-每日登陆礼包 3-周末福利礼包等 详情见B站礼包配置<br>【示例值】1 |
|gift_id |string(32) |礼包id,在B站配置完成后,可获取<br>【示例值】10003 |
|send_time |string(32) |玩家领取道具时间<br>【示例值】2023-12-03 00:00:00 |
|open_id |string(128) |接收道具的玩家openid |
|goods_list |Array. |发奖道具列表(看下房字段详情) |
goods_list字段详情:</p>
<p>|参数名|类型|说明|
|:---- |:----- |----- |
|id |string(64) |道具id, 由游戏自定义<br>【示例值】1 |
|send_count |number(32) |道具发货数量, 游戏在B站配置<br>【示例值】10 |</p>
<h2>13.4研发需返回参数说明</h2>
<p>|参数名|必选|类型|说明|
|:---- |:---|:----- |----- |
|code |是 |number |发送状态。0发送成功, 1任务未完成, 2其他错误 |
|message |否 |string |错误原因,用于调试。code等于2或者其他值的情况下可以返回 |</p>
<h2>13.5返回示例</h2>
<pre><code>{
&quot;code&quot;: 0, //0发送成功, 1任务未完成, 2其他错误
&quot;message&quot;: &quot;success&quot;
}</code></pre>