update
continuous-integration/drone/push Build is passing Details

master
kgdxpr 4 years ago
parent bb7014eeb2
commit 18653cfb92

@ -5,8 +5,6 @@
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Business/ImRelate/ImRelateController/ImRelateController.go" beforeDir="false" afterPath="$PROJECT_DIR$/Business/ImRelate/ImRelateController/ImRelateController.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Business/ImRelate/ImRelateDao/ImRelateDao.go" beforeDir="false" afterPath="$PROJECT_DIR$/Business/ImRelate/ImRelateDao/ImRelateDao.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -113,4 +111,15 @@
</map>
</environment>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/Business/ImRelate/ImRelateDao/ImRelateDao.go</url>
<line>430</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

@ -16,6 +16,7 @@ func Routers(r *gin.RouterGroup) {
rr.POST("/SaveChatRecord", SaveChatRecord)
rr.POST("/GetPersonAvatar", GetPersonAvatar)
rr.GET("/GetPersonInfoList", GetPersonInfoList)
rr.POST("/CreateGroup", CreateGroup)
rr.POST("/SyncRongYunUser", SyncRongYunUser)
}
@ -206,3 +207,32 @@ func SyncRongYunUser(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "向融云同步用户成功!"})
}
/**
2021-08-23
*/
func CreateGroup(c *gin.Context) {
//群组名称
groupName := c.PostForm("group_name")
//人员列表
personList := c.PostForm("person_list")
personIdCookie, _ := c.Cookie("person_id")
identityIdCookie, _ := c.Cookie("identity_id")
tokenCookie, _ := c.Cookie("token")
qAccessTokenCookie, _ := c.Cookie("q_access_token")
groupId, err := ImRelateDao.SaveGroup(groupName, personIdCookie, identityIdCookie, tokenCookie, qAccessTokenCookie)
if err != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": err.Error()})
return
}
err = ImRelateDao.AddGroupMember(groupId, personList, personIdCookie, identityIdCookie, tokenCookie, qAccessTokenCookie)
if err != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": "调用云平台的增加群组成员接口失败!"})
return
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "成功!"})
}

@ -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
}

Loading…
Cancel
Save