GroupHandlePendency
功能介绍
处理群未决信息
对于群的未决信息,ImSDK增加了处理接口。审批人可以选择对单条信息进行同意或者拒绝。已处理成功过的未决信息不能再次处理。
处理未决信息时需要带一个未决信息GroupPendency,可以在接口GroupGetPendencyList返回的未决信息列表将未决信息保存下来,
在处理未决信息的时候将GroupPendency传入GroupHandlePendencyParam中的group_handle_pendency_param_pendency 。
参数详解
重载1
参数名称 | 参数类型 | 是否必填 | 描述 |
---|---|---|---|
json_group_handle_pendency_param | GroupHandlePendencyParam | 是 | 处理群未决信息参数 |
callback | NullValueCallback | 是 | 异步回调 |
重载2
参数名称 | 参数类型 | 是否必填 | 描述 |
---|---|---|---|
json_group_handle_pendency_param | GroupHandlePendencyParam | 是 | 处理群未决信息参数 |
callback | ValueCallback< string > | 是 | 异步回调 返回值的json_param的格式为string |
返回模板
TIMResult
调用成功后回调函数参数:
code:int
desc:string
json_param:'' // json_params为空字符串""
user_data:string
返回值详解
名称 | 数值类型 | 描述 |
---|---|---|
TIMResult | TIMResult | 调用接口的返回值 |
code | int | 值为ERR_SUCC表示成功,其他值表示失败。详情请参考 错误码 |
desc | string | 错误描述字符串 |
json_param | string | Json字符串,不同的接口,Json字符串不一样 |
user_data | string | ImSDK负责透传的用户自定义数据,未做任何处理 |
代码示例
using UnityEngine;
using UnityEngine.UI;
using com.tencent.im.unity.demo.types;
using com.tencent.imsdk.unity;
using com.tencent.imsdk.unity.types;
using com.tencent.imsdk.unity.enums;
using System;
using com.tencent.im.unity.demo.utils;
using EasyUI.Toast;
using System.Collections;
using System.Text;
using System.Collections.Generic;
public class GroupHandlePendency : MonoBehaviour
{
string[] Labels = new string[] { "SelectGroupPendencyLabel", "GroupHandlePendencyMsgLabel", "GroupHandlePendencyLabel" };
public Text Header;
public Dropdown SelectedPendency;
public Toggle IsAccept;
public InputField Remark;
public Text Result;
public Button Submit;
public Button Copy;
private List<GroupPendency> PendencyList;
void Start()
{
foreach (string label in Labels)
{
GameObject.Find(label).GetComponent<Text>().text = Utils.t(label);
}
GroupGetPendencyListSDK();
Header = GameObject.Find("HeaderText").GetComponent<Text>();
Remark = GameObject.Find("Remark").GetComponent<InputField>();
SelectedPendency = GameObject.Find("Pendency").GetComponent<Dropdown>();
IsAccept = GameObject.Find("IsAccept").GetComponent<Toggle>();
Result = GameObject.Find("ResultText").GetComponent<Text>();
Submit = GameObject.Find("Submit").GetComponent<Button>();
Copy = GameObject.Find("Copy").GetComponent<Button>();
Submit.onClick.AddListener(GroupHandlePendencySDK);
Copy.GetComponentInChildren<Text>().text = Utils.t("Copy");
Copy.onClick.AddListener(CopyText);
if (CurrentSceneInfo.info != null)
{
Header.text = Utils.IsCn() ? CurrentSceneInfo.info.apiText + " " + CurrentSceneInfo.info.apiName : CurrentSceneInfo.info.apiName;
Submit.GetComponentInChildren<Text>().text = CurrentSceneInfo.info.apiName;
}
}
void GetPendencyList(params object[] parameters)
{
try
{
PendencyList = new List<GroupPendency>();
SelectedPendency.ClearOptions();
string text = (string)parameters[1];
List<GroupPendency> List = Utils.FromJson<GroupPendencyResult>(text).group_pendency_result_pendency_array;
Dropdown.OptionData option = new Dropdown.OptionData();
foreach (GroupPendency item in List)
{
print(item.group_pendency_group_id);
PendencyList.Add(item);
option = new Dropdown.OptionData();
option.text = item.group_pendency_group_id;
SelectedPendency.options.Add(option);
}
if (List.Count > 0)
{
SelectedPendency.captionText.text = List[SelectedPendency.value].group_pendency_group_id;
}
}
catch (Exception ex)
{
Toast.Show(Utils.t("getGroupPendencyListFailed"));
}
}
void GroupGetPendencyListSDK()
{
GroupPendencyOption param = new GroupPendencyOption
{
group_pendency_option_start_time = 0
};
TIMResult res = TencentIMSDK.GroupGetPendencyList(param, Utils.addAsyncStringDataToScreen(GetPendencyList));
print($"GroupGetPendencyListSDK {res}");
}
void GroupHandlePendencySDK()
{
if (PendencyList.Count < 1) return;
print("GroupId: " + PendencyList[SelectedPendency.value].group_pendency_group_id);
var param = new GroupHandlePendencyParam
{
group_handle_pendency_param_is_accept = IsAccept.isOn,
group_handle_pendency_param_handle_msg = Remark.text,
group_handle_pendency_param_pendency = PendencyList[SelectedPendency.value],
};
TIMResult res = TencentIMSDK.GroupHandlePendency(param, Utils.addAsyncNullDataToScreen(GetResult));
Result.text = Utils.SynchronizeResult(res);
}
void GetResult(params object[] parameters)
{
GroupGetPendencyListSDK();
Result.text += (string)parameters[0];
}
void CopyText()
{
Utils.Copy(Result.text);
}
void OnApplicationQuit()
{
TencentIMSDK.Uninit();
}
}