|
|
|
@ -13,6 +13,8 @@ import (
|
|
|
|
|
"github.com/astaxie/beego/httplib"
|
|
|
|
|
"github.com/rongcloud/server-sdk-go/v3/sdk"
|
|
|
|
|
"github.com/xormplus/xorm"
|
|
|
|
|
"net/http"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -45,6 +47,13 @@ type PersonList struct {
|
|
|
|
|
AvatarUrl string `json:"avatar_url"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//群组
|
|
|
|
|
type Group struct {
|
|
|
|
|
Id int `json:"id"`
|
|
|
|
|
Success bool `json:"success"`
|
|
|
|
|
Info string `json:"info"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//聊天记录结构
|
|
|
|
|
type ChatRecordStruct struct {
|
|
|
|
|
SenderUserId string `json:"sender_user_id"`
|
|
|
|
@ -375,3 +384,113 @@ func GetPersonList(bureauId string, orgId string, queryChild string, bUse string
|
|
|
|
|
|
|
|
|
|
return string(jsonBytes), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
功能:调用云平台的创建群组接口
|
|
|
|
|
作者:吴缤
|
|
|
|
|
日期:2021-09-09
|
|
|
|
|
*/
|
|
|
|
|
func SaveGroup(groupName string, personIdCookie string, identityIdCookie string, tokenCookie string, qAccessTokenCookie string) (string, error) {
|
|
|
|
|
req := httplib.Post(fmt.Sprintf("%s/dsideal_yy/ypt/group/saveGroup", ConfigUtil.DsidealYy))
|
|
|
|
|
|
|
|
|
|
req.Param("group_name", groupName)
|
|
|
|
|
req.Param("group_desc", "")
|
|
|
|
|
req.Param("avater_url", "OTc1MEE2RjgtMkNCRi00Q0YwLUEyNTQtRjI1MjhDNDVEM0E4LnBuZw==")
|
|
|
|
|
req.Param("parent_type", "-1")
|
|
|
|
|
req.Param("parent_id", "-1")
|
|
|
|
|
req.Param("group_type", "2")
|
|
|
|
|
req.Param("use_range", "1")
|
|
|
|
|
req.Param("plat_type", "1")
|
|
|
|
|
req.Param("plat_id", "0")
|
|
|
|
|
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "person_id",
|
|
|
|
|
Value: personIdCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "identity_id",
|
|
|
|
|
Value: identityIdCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "token",
|
|
|
|
|
Value: tokenCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "q_access_token",
|
|
|
|
|
Value: qAccessTokenCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
resStr, err := req.String()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var g Group
|
|
|
|
|
json.Unmarshal([]byte(resStr), &g)
|
|
|
|
|
|
|
|
|
|
if !g.Success {
|
|
|
|
|
return "", errors.New(g.Info)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return strconv.Itoa(g.Id), nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
功能:调用云平台的增加群组成员接口
|
|
|
|
|
作者:吴缤
|
|
|
|
|
日期:2021-09-09
|
|
|
|
|
*/
|
|
|
|
|
func AddGroupMember(groupId string, personList string, personIdCookie string, identityIdCookie string, tokenCookie string, qAccessTokenCookie string) error {
|
|
|
|
|
req := httplib.Post(fmt.Sprintf("%s/dsideal_yy/ypt/group/addMember", ConfigUtil.DsidealYy))
|
|
|
|
|
|
|
|
|
|
req.Param("groupId", groupId)
|
|
|
|
|
req.Param("pids", personList)
|
|
|
|
|
req.Param("random_num", CommonUtil.GetSixRandom())
|
|
|
|
|
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "person_id",
|
|
|
|
|
Value: personIdCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "identity_id",
|
|
|
|
|
Value: identityIdCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "token",
|
|
|
|
|
Value: tokenCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
req.SetCookie(&http.Cookie{
|
|
|
|
|
Name: "q_access_token",
|
|
|
|
|
Value: qAccessTokenCookie,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Domain: "10.10.14.199",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
resStr, err := req.String()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var g Group
|
|
|
|
|
json.Unmarshal([]byte(resStr), &g)
|
|
|
|
|
|
|
|
|
|
if !g.Success {
|
|
|
|
|
return errors.New("调用云平台的增加群组成员接口失败!")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|