Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bmob/BmobDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
pkball committed Sep 5, 2024
2 parents 16dc608 + 20a165e commit e2c097c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 66 deletions.
37 changes: 5 additions & 32 deletions docs/cloud_function/web/hook/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,6 @@

</li>

<li class=""><a href="#ip">限制或者允许某个IP的操作</a>

</li>

<li class=""><a href="#androidiosapi">限制或者允许某个平台(Android、iOS或者API)的访问</a>

</li>
Expand Down Expand Up @@ -502,9 +498,6 @@
<p>限制或者允许某些表的增加、更新、删除或者查询。</p>
</li>
<li>
<p>限制或者允许某个IP的操作。</p>
</li>
<li>
<p>限制或者允许某个平台(Android、iOS或者API)的访问。</p>
</li>
<li>
Expand All @@ -526,10 +519,10 @@ <h2 id="_2">限制或者允许某些表的增删改查<a class="headerlink" href

let tableName = request.body.table;
if(tableName==&quot;Order&quot;) {
response.end({&quot;msg&quot;: tableName + &quot;表禁止操作&quot;});
response.send({&quot;msg&quot;: tableName + &quot;表禁止操作&quot;});
}
else{
response.end({&quot;msg&quot;: &quot;ok&quot;});
response.send({&quot;msg&quot;: &quot;ok&quot;});
}
}

Expand All @@ -543,9 +536,6 @@ <h2 id="_2">限制或者允许某些表的增删改查<a class="headerlink" href
<p><code>request.body.caller</code> :表示请求的客户端,值分别为:Android、IOS或者空。</p>
</li>
<li>
<p><code>request.body.ip</code> :表示请求的IP地址。</p>
</li>
<li>
<p><code>request.body.ua</code> :表示请求的user_agent信息。</p>
</li>
<li>
Expand All @@ -555,34 +545,17 @@ <h2 id="_2">限制或者允许某些表的增删改查<a class="headerlink" href
<p><code>request.body.operation</code> :表示请求类型,值分别是:<code>create</code><code>update</code><code>delete</code><code>query</code></p>
</li>
</ul>
<h2 id="ip">限制或者允许某个IP的操作<a class="headerlink" href="#ip" title="Permanent link">&para;</a></h2>
<p>如果我们要设置<code>112.112.112.112</code>这个IP才能对各种表进行编辑、删除和修改操作,可以编写云函数如下:</p>
<pre><code class="java">
function onRequest(request, response, modules) {
// 获取请求ip
let ip = request.body.ip;
// 获取请求类型
let operation = request.body.operation;
if(operation==&quot;query&quot; || (ip==&quot;112.112.112.112&quot; &amp;&amp; operation!=&quot;query&quot;)){
response.end({&quot;msg&quot;:&quot;ok&quot;});
}
else{
response.end({&quot;msg&quot;:&quot;禁止操作&quot;});
}

</code></pre>

<h2 id="androidiosapi">限制或者允许某个平台(Android、iOS或者API)的访问<a class="headerlink" href="#androidiosapi" title="Permanent link">&para;</a></h2>
<p>如果我们要限制IOS平台的访问,可以编写云函数如下:</p>
<pre><code class="java">
function onRequest(request, response, modules) {
// 获取请求平台
let caller = request.body.caller;
if(caller==&quot;IOS&quot;)){
response.end({&quot;msg&quot;:&quot;禁止IOS访问&quot;});
response.send({&quot;msg&quot;:&quot;禁止IOS访问&quot;});
}
else{
response.end({&quot;msg&quot;:&quot;ok&quot;});
response.send({&quot;msg&quot;:&quot;ok&quot;});
}

</code></pre>
Expand All @@ -600,7 +573,7 @@ <h2 id="_3">对客户端上传的数据进行二次校验和处理<a class="head
&quot;data&quot;: JSON.stringify(data)
};

response.send(backData);
response.end(backData);
}

</code></pre>
Expand Down
68 changes: 34 additions & 34 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<url>
<loc>/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -25,7 +25,7 @@

<url>
<loc>/data/harmony/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand Down Expand Up @@ -61,25 +61,25 @@

<url>
<loc>/data/cocos2d_x/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/data/wechat_app_new/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/data/wechat_app_new/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/data/wechat_app_new/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -91,19 +91,19 @@

<url>
<loc>/data/kotlin/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/data/python/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/data/flutter/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -119,49 +119,49 @@

<url>
<loc>/cloud_function/android/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/ios/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/java/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/python/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/csharp/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/php/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/javascript/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/cloud_function/restful/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -171,37 +171,37 @@

<url>
<loc>/sms/android/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/sms/ios/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/sms/php/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/sms/javascript/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/sms/restful/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/sms/python/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -211,37 +211,37 @@

<url>
<loc>/ai/android/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/ai/ios/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/ai/html5/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/ai/html5/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/ai/api/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/ai/python/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand All @@ -251,31 +251,31 @@

<url>
<loc>/other/domain/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/other/common_problem/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/other/error_code/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/other/data_safety/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

<url>
<loc>/other/bql/</loc>
<lastmod>2024-09-02</lastmod>
<lastmod>2024-09-05</lastmod>
<changefreq>daily</changefreq>
</url>

Expand Down

0 comments on commit e2c097c

Please sign in to comment.