Skip to content

Commit

Permalink
Merge pull request #319 from zhanghengrui-ifanr/master
Browse files Browse the repository at this point in the history
开放 API 新增后台运营部署功能
  • Loading branch information
zhanghengrui-ifanr authored Nov 4, 2022
2 parents 73a6329 + 0e4e8a7 commit f8347ed
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 2 deletions.
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
* [组集操作](open-api/group/super-group.md)
* [云函数](open-api/cloud-function.md)
* [短信服务](open-api/sms.md)
* [运营后台](open-api/user-dash.md)

----

Expand Down
1 change: 1 addition & 0 deletions open-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
* [用户模块](./user/README.md)
* [云函数](./cloud-function.md)
* [工具模块](./utils.md)
* [运营模块](./user-dash.md)
4 changes: 2 additions & 2 deletions open-api/data/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
| user:<:user_id> | String| 某个用户可写/可读 |
| gid:<:group_id> | String| 某个分组下的用户可写/可读 |

具体描述与使用场景可参考[ACL 访问控制列表](../../dashboard/acl.md)
具体描述与使用场景可参考[ACL 访问控制列表](../../dashboard/basic-services/acl.md)

参数 schema 用于存储数据表字段的元信息,其结构遵循[JSON-Table-Schema](https://frictionlessdata.io/specs/table-schema/)的描述。

Expand Down Expand Up @@ -236,7 +236,7 @@ curl_close($ch);
{
"name": "String",
"type": "string",
"description": "string",
"description": "string"
}
]
},
Expand Down
100 changes: 100 additions & 0 deletions open-api/user-dash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# 运营后台

## 部署运营后台

**接口**

`POST https://cloud.minapp.com/oserve/v2.6/miniapp/custom-userdash/`

**参数说明**

Content-Type: `application/json`

| 参数 | 类型 | 必填 | 说明 |
| :------------ | :----- | :-- | :-- |
| repository_path | String | N | 自定义管理后台部署压缩包地址,需要先调用[上传文件接口](./file/file-upload.md)获取文件上传成功后的访问地址 |
| url_refresh | String | N | 是否刷新管理后台部署地址,取值为:true or false,可为空,默认为 true |

**代码示例**

{% tabs createCustomUserDashCurl="Curl", createCustomUserDashNode="Node", createCustomUserDashPHP="PHP" %}

{% content "createCustomUserDashCurl"%}

```
curl -X POST \
-H "Authorization: Bearer 52ce223c5adbb66fa188a959a8b08889adb3580c" \
-H "Content-Type: application/json" \
-d '{
"repository_path":"https://baas-hello-world.cloud.ifanrusercontent.com/test.zip",
"url_refresh": true
}' \
https://cloud.minapp.com/oserve/v2.6/miniapp/custom-userdash/
```

{% content "createCustomUserDashNode"%}

```js
var request = require('request');

var opt = {
uri: 'https://cloud.minapp.com/oserve/v2.6/miniapp/custom-userdash/',
method: 'POST',
headers: {
Authorization: `Bearer ${token}`
},
json: {
repository_path: 'https://baas-hello-world.cloud.ifanrusercontent.com/test.zip',
url_refresh: 'true'
}
}

request(opt, function(err, res, body) {
console.log(res.statusCode, body)
})
```

{% content "createCustomUserDashPHP"%}

```php
<?php
$param = array(
'repository_path' =>'https://baas-hello-world.cloud.ifanrusercontent.com/test.zip',
'url_refresh'=> 'true'
);
$url = 'https://cloud.minapp.com/oserve/v2.6/miniapp/custom-userdash/';

$ch = curl_init();
$header = array(
"Authorization: Bearer {$token}",
'Content-Type: application/json; charset=utf-8'
);

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($param));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

$res['response'] = curl_exec($ch); // 反馈结果
$res['status_code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 请求状态码
curl_close($ch);
```

{% endtabs %}

**返回示例**

```json
{
"message": "Submit deploy request succeed.",
"status": "ok"
}
```

**状态码说明**

`200` 成功
`403` 套餐不符合或企业认证未完成

0 comments on commit f8347ed

Please sign in to comment.