feat(app): update
This commit is contained in:
@ -885,7 +885,7 @@ func (client *ImClient) CreateProGroup(tname, owner, announcement, avatar, msg s
|
||||
}
|
||||
|
||||
// GroupUpdate 更新群组
|
||||
func (client *ImClient) GroupUpdate(ctx context.Context, id, operator_id, name, announcement, icon string) error {
|
||||
func (client *ImClient) GroupUpdate(ctx context.Context, id, operator_id, name, announcement, icon, extension string) error {
|
||||
url := "https://open.yunxinapi.com/im/v2.1/teams/" + id
|
||||
httpMethod := "PATCH"
|
||||
header := client.generateJsonHeader()
|
||||
@ -900,6 +900,9 @@ func (client *ImClient) GroupUpdate(ctx context.Context, id, operator_id, name,
|
||||
// "agree_mode": agree_mode, 邀请入群时是否需要被邀请人的同意。0(默认):需要被邀请人同意才能入群。1:不需要被邀请人同意,直接入群。
|
||||
// "invite_mode": invite_mode, 邀请权限,即谁可以邀请他人入群。0(默认):群主和管理员。1:所有人。
|
||||
}
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
@ -932,6 +935,9 @@ func (client *ImClient) GroupTransfer(ctx context.Context, id, new_owner, extens
|
||||
"leave": 2,
|
||||
// "extension": extension,
|
||||
}
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
@ -964,6 +970,9 @@ func (client *ImClient) GroupManagerAdd(ctx context.Context, id, operator_id, ex
|
||||
"operator_id": operator_id,
|
||||
// "extension": extension,
|
||||
}
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
@ -996,6 +1005,9 @@ func (client *ImClient) GroupManagerRemove(ctx context.Context, id, operator_id,
|
||||
"operator_id": operator_id,
|
||||
// "extension": extension,
|
||||
}
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
// var params []string
|
||||
// for k, v := range reqBody {
|
||||
// params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
@ -1032,16 +1044,19 @@ func (client *ImClient) GroupRemove(ctx context.Context, id, operator_id, extens
|
||||
"operator_id": operator_id,
|
||||
// "extension": extension,
|
||||
}
|
||||
var params []string
|
||||
for k, v := range reqBody {
|
||||
params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
// bodyBytes, err := json.Marshal(reqBody)
|
||||
// if err != nil {
|
||||
// return errors.WithStack(err)
|
||||
// var params []string
|
||||
// for k, v := range reqBody {
|
||||
// params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
// }
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, "")
|
||||
// url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, string(bodyBytes))
|
||||
if err != nil {
|
||||
log.InfoF("GroupRemove %s:"+err.Error(), operator_id)
|
||||
return errors.WithStack(err)
|
||||
@ -1070,16 +1085,19 @@ func (client *ImClient) GroupMemberKick(ctx context.Context, tid, operator_id, e
|
||||
"kick_account_ids": members,
|
||||
// "extension": extension,
|
||||
}
|
||||
var params []string
|
||||
for k, v := range reqBody {
|
||||
params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
// bodyBytes, err := json.Marshal(reqBody)
|
||||
// if err != nil {
|
||||
// return errors.WithStack(err)
|
||||
// var params []string
|
||||
// for k, v := range reqBody {
|
||||
// params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
// }
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, "")
|
||||
// url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, string(bodyBytes))
|
||||
if err != nil {
|
||||
log.InfoF("GroupMemberKick %s:"+err.Error(), operator_id)
|
||||
return errors.WithStack(err)
|
||||
@ -1107,16 +1125,19 @@ func (client *ImClient) GroupMemberLeave(ctx context.Context, tid, account_id, e
|
||||
"team_id": tools.StrToInt(tid),
|
||||
// "extension": extension,
|
||||
}
|
||||
var params []string
|
||||
for k, v := range reqBody {
|
||||
params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
// bodyBytes, err := json.Marshal(reqBody)
|
||||
// if err != nil {
|
||||
// return errors.WithStack(err)
|
||||
// var params []string
|
||||
// for k, v := range reqBody {
|
||||
// params = append(params, fmt.Sprintf("%s=%v", k, v))
|
||||
// }
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, "")
|
||||
// url = fmt.Sprintf("%s?%s", url, strings.Join(params, "&"))
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
res, err := HyTools.HttpDo(httpMethod, url, header, string(bodyBytes))
|
||||
if err != nil {
|
||||
log.InfoF("GroupMemberLeave %s:"+err.Error(), tid)
|
||||
return errors.WithStack(err)
|
||||
@ -1144,7 +1165,10 @@ func (client *ImClient) GroupMemberJoin(ctx context.Context, tid, operator_id, m
|
||||
"team_id": tools.StrToInt(tid),
|
||||
"msg": msg,
|
||||
"invite_account_ids": invite_account_ids,
|
||||
"extension": extension,
|
||||
// "extension": extension,
|
||||
}
|
||||
if len(extension) > 0 {
|
||||
reqBody["extension"] = extension
|
||||
}
|
||||
bodyBytes, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user