Skip to content

Commit

Permalink
修复BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
dobyte committed Nov 5, 2021
1 parent 904e8e7 commit db32579
Show file tree
Hide file tree
Showing 22 changed files with 751 additions and 412 deletions.
55 changes: 52 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func main() {
<td>√</td>
</tr>
<tr>
<td rowspan="21">关系链管理</td>
<td rowspan="23">关系链管理</td>
<td>
<a href="https://cloud.tencent.com/document/product/269/1643">添加单个好友</a>
</td>
Expand Down Expand Up @@ -288,6 +288,21 @@ func main() {
</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/1647">拉取好友</a>
</td>
<td>SNS.PullFriends</td>
<td>
<ul>
<li>本API是借助"拉取好友"API进行扩展实现</li>
<li>分页拉取全量好友数据。</li>
<li>不支持资料数据的拉取。</li>
<li>不需要指定请求拉取的字段,默认返回全量的标配好友数据和自定义好友数据。</li>
</ul>
</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/8609">拉取单个指定好友</a>
Expand Down Expand Up @@ -338,6 +353,19 @@ func main() {
<td>支持分页拉取所有黑名单。</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/3722">拉取黑名单</a>
</td>
<td>SNS.PullBlacklist</td>
<td>
<ul>
<li>本API是借助"拉取黑名单"API进行扩展实现</li>
<li>支持分页拉取所有黑名单。</li>
</ul>
</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/3725">校验黑名单</a>
Expand Down Expand Up @@ -641,7 +669,7 @@ func main() {
<td>√</td>
</tr>
<tr>
<td rowspan="28">群组管理</td>
<td rowspan="29">群组管理</td>
<td>
<a href="https://cloud.tencent.com/document/product/269/1614">拉取App中的所有群组ID</a>
</td>
Expand All @@ -657,6 +685,14 @@ func main() {
<td>本方法由“拉取App中的所有群组ID(FetchGroupIds)”拓展而来</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/1614">续拉取App中的所有群组</a>
</td>
<td>Group.PullGroups</td>
<td>本方法由“拉取App中的所有群组(FetchGroups)”拓展而来</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/1615">创建群组</a>
Expand Down Expand Up @@ -899,14 +935,27 @@ func main() {
<td>√</td>
</tr>
<tr>
<td rowspan="2">最近联系人</td>
<td rowspan="3">最近联系人</td>
<td>
<a href="https://cloud.tencent.com/document/product/269/62118">拉取会话列表</a>
</td>
<td>RecentContact.FetchSessions</td>
<td>支持分页拉取会话列表。</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/62118">拉取会话列表</a>
</td>
<td>RecentContact.PullSessions</td>
<td>
<ul>
<li>本API是借助"拉取会话列表"API进行扩展实现</li>
<li>支持分页拉取会话列表。</li>
</ul>
</td>
<td>√</td>
</tr>
<tr>
<td>
<a href="https://cloud.tencent.com/document/product/269/62119">删除单个会话</a>
Expand Down
13 changes: 6 additions & 7 deletions account/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package account

import (
"errors"
"fmt"

"github.com/dobyte/tencent-im/internal/core"
Expand Down Expand Up @@ -121,10 +120,10 @@ func (a *api) ImportAccount(account *Account) (err error) {
// https://cloud.tencent.com/document/product/269/4919
func (a *api) ImportAccounts(userIds ...string) (failUserIds []string, err error) {
if c := len(userIds); c == 0 {
err = errors.New("the account is not set")
err = core.NewError(enum.InvalidParamsCode, "the userid is not set")
return
} else if c > batchImportAccountsLimit {
err = errors.New(fmt.Sprintf("the number of imported accounts cannot exceed %d", batchImportAccountsLimit))
err = core.NewError(enum.InvalidParamsCode, fmt.Sprintf("the number of imported accounts cannot exceed %d", batchImportAccountsLimit))
return
}

Expand Down Expand Up @@ -166,10 +165,10 @@ func (a *api) DeleteAccount(userId string) (err error) {
// https://cloud.tencent.com/document/product/269/36443
func (a *api) DeleteAccounts(userIds ...string) (results []*DeleteResult, err error) {
if c := len(userIds); c == 0 {
err = errors.New("the account is not set")
err = core.NewError(enum.InvalidParamsCode, "the userid is not set")
return
} else if c > batchDeleteAccountsLimit {
err = errors.New(fmt.Sprintf("the number of deleted accounts cannot exceed %d", batchDeleteAccountsLimit))
err = core.NewError(enum.InvalidParamsCode, fmt.Sprintf("the number of deleted accounts cannot exceed %d", batchDeleteAccountsLimit))
return
}

Expand Down Expand Up @@ -219,10 +218,10 @@ func (a *api) CheckAccount(userId string) (bool, error) {
// https://cloud.tencent.com/document/product/269/38417
func (a *api) CheckAccounts(userIds ...string) (results []*CheckResult, err error) {
if c := len(userIds); c == 0 {
err = errors.New("the account is not set")
err = core.NewError(enum.InvalidParamsCode, "the account is not set")
return
} else if c > batchCheckAccountsLimit {
err = errors.New(fmt.Sprintf("the number of checked accounts cannot exceed %d", batchCheckAccountsLimit))
err = core.NewError(enum.InvalidParamsCode, fmt.Sprintf("the number of checked accounts cannot exceed %d", batchCheckAccountsLimit))
return
}

Expand Down
4 changes: 2 additions & 2 deletions account/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ type (

// 批量导入账号(参数)
importAccountsReq struct {
UserIds []string `json:"UserIds"` // (必填)用户名,单个用户名长度不超过32字节,单次最多导入100个用户名
UserIds []string `json:"Accounts"` // (必填)用户名,单个用户名长度不超过32字节,单次最多导入100个用户名
}

// 批量导入账号(响应)
importAccountsResp struct {
types.ActionBaseResp
FailUserIds []string `json:"FailUserIds"` // 导入失败的帐号列表
FailUserIds []string `json:"FailAccounts"` // 导入失败的帐号列表
}

// 账号项
Expand Down
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func main() {
FaceUrl: "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png",
}); err != nil {
if e, ok := err.(im.Error); ok {
fmt.Println(fmt.Sprintf("import accout failed, code:%d, message:%s.", e.Code(), e.Message()))
fmt.Println(fmt.Sprintf("import account failed, code:%d, message:%s.", e.Code(), e.Message()))
} else {
fmt.Println(fmt.Sprintf("import accout failed:%s.", err.Error()))
fmt.Println(fmt.Sprintf("import account failed:%s.", err.Error()))
}
}

Expand Down
Loading

0 comments on commit db32579

Please sign in to comment.