|
|
@ -12,267 +12,122 @@ import (
|
|
|
|
//模块的路由配置
|
|
|
|
//模块的路由配置
|
|
|
|
func Routers(r *gin.RouterGroup) {
|
|
|
|
func Routers(r *gin.RouterGroup) {
|
|
|
|
rr := r.Group("/imRelate")
|
|
|
|
rr := r.Group("/imRelate")
|
|
|
|
rr.POST("/sendTxtMsg", sendTxtMsg)
|
|
|
|
rr.POST("/saveChatRecord", saveChatRecord)
|
|
|
|
rr.POST("/sendImgMsg", sendImgMsg)
|
|
|
|
|
|
|
|
rr.POST("/sendFileMsg", sendFileMsg)
|
|
|
|
|
|
|
|
rr.POST("/sendSightMsg", sendSightMsg)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
功能:发送融云文本消息
|
|
|
|
功能:保存聊天记录
|
|
|
|
作者:吴缤
|
|
|
|
作者:吴缤
|
|
|
|
日期:2021-08-16
|
|
|
|
日期:2021-08-23
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
func sendTxtMsg(c *gin.Context) {
|
|
|
|
func saveChatRecord(c *gin.Context) {
|
|
|
|
//发送方Id。
|
|
|
|
//发送方Id。
|
|
|
|
fromId := c.PostForm("fromId")
|
|
|
|
fromId := c.PostForm("fromId")
|
|
|
|
//接收方Id。
|
|
|
|
//接收方Id。
|
|
|
|
toId := c.PostForm("toId")
|
|
|
|
toId := c.PostForm("toId")
|
|
|
|
//发送类型 p:单聊 g:群聊
|
|
|
|
//发送类型 p:单聊 g:群聊
|
|
|
|
sendType := c.PostForm("sendType")
|
|
|
|
sendType := c.PostForm("sendType")
|
|
|
|
//内容。
|
|
|
|
|
|
|
|
content := c.PostForm("content")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m := map[string]string{"content": content}
|
|
|
|
//获取姓名和头像
|
|
|
|
contentJsonObj, _ := json.Marshal(m)
|
|
|
|
fromName, fromAvatar, toName, toAvatar := ImRelateDao.GetPersonNameAvatar(fromId, toId, sendType)
|
|
|
|
contentJsonStr := string(contentJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
var crs ImRelateDao.ChatRecordStruct
|
|
|
|
sendErr := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:TxtMsg", contentJsonStr)
|
|
|
|
|
|
|
|
if sendErr != nil {
|
|
|
|
objectName := c.PostForm("objectName")
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "发送消息失败!"})
|
|
|
|
if objectName == "RC:TxtMsg" {
|
|
|
|
|
|
|
|
//内容。
|
|
|
|
|
|
|
|
content := c.PostForm("content")
|
|
|
|
|
|
|
|
crs = ImRelateDao.ChatRecordStruct{
|
|
|
|
|
|
|
|
SenderUserId: fromId,
|
|
|
|
|
|
|
|
SenderUserName: fromName,
|
|
|
|
|
|
|
|
SenderUserAvatar: fromAvatar,
|
|
|
|
|
|
|
|
ReceiverUserId: toId,
|
|
|
|
|
|
|
|
ReceiverUserName: toName,
|
|
|
|
|
|
|
|
ReceiverUserAvatar: toAvatar,
|
|
|
|
|
|
|
|
SendTime: CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
Content: content,
|
|
|
|
|
|
|
|
MessageType: objectName,
|
|
|
|
|
|
|
|
ChatType: sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if objectName == "RC:ImgMsg" {
|
|
|
|
|
|
|
|
//图片base64。
|
|
|
|
|
|
|
|
imgBase64 := c.PostForm("imgBase64")
|
|
|
|
|
|
|
|
//imgUrl
|
|
|
|
|
|
|
|
imgUrl := c.PostForm("imgUrl")
|
|
|
|
|
|
|
|
//文件名
|
|
|
|
|
|
|
|
fileName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crs = ImRelateDao.ChatRecordStruct{
|
|
|
|
|
|
|
|
SenderUserId: fromId,
|
|
|
|
|
|
|
|
SenderUserName: fromName,
|
|
|
|
|
|
|
|
SenderUserAvatar: fromAvatar,
|
|
|
|
|
|
|
|
ReceiverUserId: toId,
|
|
|
|
|
|
|
|
ReceiverUserName: toName,
|
|
|
|
|
|
|
|
ReceiverUserAvatar: toAvatar,
|
|
|
|
|
|
|
|
SendTime: CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
Content: fileName,
|
|
|
|
|
|
|
|
Base64: imgBase64,
|
|
|
|
|
|
|
|
Url: imgUrl,
|
|
|
|
|
|
|
|
MessageType: objectName,
|
|
|
|
|
|
|
|
ChatType: sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if objectName == "RC:FileMsg" {
|
|
|
|
|
|
|
|
//文件名
|
|
|
|
|
|
|
|
fileName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
//文件大小
|
|
|
|
|
|
|
|
fileSize := c.PostForm("fileSize")
|
|
|
|
|
|
|
|
//文件类型
|
|
|
|
|
|
|
|
fileType := c.PostForm("fileType")
|
|
|
|
|
|
|
|
//文件URL
|
|
|
|
|
|
|
|
fileUrl := c.PostForm("fileUrl")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crs = ImRelateDao.ChatRecordStruct{
|
|
|
|
|
|
|
|
SenderUserId: fromId,
|
|
|
|
|
|
|
|
SenderUserName: fromName,
|
|
|
|
|
|
|
|
SenderUserAvatar: fromAvatar,
|
|
|
|
|
|
|
|
ReceiverUserId: toId,
|
|
|
|
|
|
|
|
ReceiverUserName: toName,
|
|
|
|
|
|
|
|
ReceiverUserAvatar: toAvatar,
|
|
|
|
|
|
|
|
SendTime: CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
Content: fileName,
|
|
|
|
|
|
|
|
Size: fileSize,
|
|
|
|
|
|
|
|
FileType: fileType,
|
|
|
|
|
|
|
|
Url: fileUrl,
|
|
|
|
|
|
|
|
MessageType: objectName,
|
|
|
|
|
|
|
|
ChatType: sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if objectName == "RC:SightMsg" {
|
|
|
|
|
|
|
|
//视频URL
|
|
|
|
|
|
|
|
videoUrl := c.PostForm("videoUrl")
|
|
|
|
|
|
|
|
//视频缩略图base64编码
|
|
|
|
|
|
|
|
thumbBase64 := ConfigUtil.VideoThumb
|
|
|
|
|
|
|
|
//视频大小
|
|
|
|
|
|
|
|
videoSize := c.PostForm("videoSize")
|
|
|
|
|
|
|
|
//视频名称
|
|
|
|
|
|
|
|
videoName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crs = ImRelateDao.ChatRecordStruct{
|
|
|
|
|
|
|
|
SenderUserId: fromId,
|
|
|
|
|
|
|
|
SenderUserName: fromName,
|
|
|
|
|
|
|
|
SenderUserAvatar: fromAvatar,
|
|
|
|
|
|
|
|
ReceiverUserId: toId,
|
|
|
|
|
|
|
|
ReceiverUserName: toName,
|
|
|
|
|
|
|
|
ReceiverUserAvatar: toAvatar,
|
|
|
|
|
|
|
|
SendTime: CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
Content: videoName,
|
|
|
|
|
|
|
|
Size: videoSize,
|
|
|
|
|
|
|
|
Base64: thumbBase64,
|
|
|
|
|
|
|
|
Url: videoUrl,
|
|
|
|
|
|
|
|
MessageType: objectName,
|
|
|
|
|
|
|
|
ChatType: sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "objectName参数错误!"})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fromName := ImRelateDao.GetPersonNameByUserId(fromId)
|
|
|
|
bodyJsonObj, _ := json.Marshal(crs)
|
|
|
|
fromAvatar := ImRelateDao.GetPersonAvatarByUserId(fromId)
|
|
|
|
|
|
|
|
var toName, toAvatar string
|
|
|
|
|
|
|
|
if sendType == "p" {
|
|
|
|
|
|
|
|
toName = ImRelateDao.GetPersonNameByUserId(toId)
|
|
|
|
|
|
|
|
toAvatar = ImRelateDao.GetPersonAvatarByUserId(toId)
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
toName, toAvatar = ImRelateDao.GetGroupNameAvatarByGroupId(toId)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cm := map[string]string{
|
|
|
|
|
|
|
|
"sender_user_id": fromId,
|
|
|
|
|
|
|
|
"sender_user_name": fromName,
|
|
|
|
|
|
|
|
"sender_user_avatar": fromAvatar,
|
|
|
|
|
|
|
|
"receiver_user_id": toId,
|
|
|
|
|
|
|
|
"receiver_user_name": toName,
|
|
|
|
|
|
|
|
"receiver_user_avatar": toAvatar,
|
|
|
|
|
|
|
|
"send_time": CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
"content": content,
|
|
|
|
|
|
|
|
"message_type": "TxtMsg",
|
|
|
|
|
|
|
|
"chat_type": sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bodyJsonObj, _ := json.Marshal(cm)
|
|
|
|
|
|
|
|
bodyString := string(bodyJsonObj)
|
|
|
|
bodyString := string(bodyJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
saveErr := ImRelateDao.SaveChatRecord("chat_record", bodyString)
|
|
|
|
|
|
|
|
if saveErr != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "聊天记录保存失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送消息成功!"})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
功能:发送融云图片消息
|
|
|
|
|
|
|
|
作者:吴缤
|
|
|
|
|
|
|
|
日期:2021-08-16
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func sendImgMsg(c *gin.Context) {
|
|
|
|
|
|
|
|
//发送方Id。
|
|
|
|
|
|
|
|
fromId := c.PostForm("fromId")
|
|
|
|
|
|
|
|
//接收方Id。
|
|
|
|
|
|
|
|
toId := c.PostForm("toId")
|
|
|
|
|
|
|
|
//发送类型 p:单聊 g:群聊
|
|
|
|
|
|
|
|
sendType := c.PostForm("sendType")
|
|
|
|
|
|
|
|
//图片base64。
|
|
|
|
|
|
|
|
imgBase64 := c.PostForm("imgBase64")
|
|
|
|
|
|
|
|
//imgUrl
|
|
|
|
|
|
|
|
imgUrl := c.PostForm("imgUrl")
|
|
|
|
|
|
|
|
//文件名
|
|
|
|
|
|
|
|
fileName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m := map[string]string{"content": imgBase64, "imageUri": imgUrl}
|
|
|
|
|
|
|
|
contentJsonObj, _ := json.Marshal(m)
|
|
|
|
|
|
|
|
contentJsonStr := string(contentJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:ImgMsg", contentJsonStr)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "发送消息失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fromName := ImRelateDao.GetPersonNameByUserId(fromId)
|
|
|
|
|
|
|
|
fromAvatar := ImRelateDao.GetPersonAvatarByUserId(fromId)
|
|
|
|
|
|
|
|
var toName, toAvatar string
|
|
|
|
|
|
|
|
if sendType == "p" {
|
|
|
|
|
|
|
|
toName = ImRelateDao.GetPersonNameByUserId(toId)
|
|
|
|
|
|
|
|
toAvatar = ImRelateDao.GetPersonAvatarByUserId(toId)
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
toName, toAvatar = ImRelateDao.GetGroupNameAvatarByGroupId(toId)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cm := map[string]string{
|
|
|
|
|
|
|
|
"sender_user_id": fromId,
|
|
|
|
|
|
|
|
"sender_user_name": fromName,
|
|
|
|
|
|
|
|
"sender_user_avatar": fromAvatar,
|
|
|
|
|
|
|
|
"receiver_user_id": toId,
|
|
|
|
|
|
|
|
"receiver_user_name": toName,
|
|
|
|
|
|
|
|
"receiver_user_avatar": toAvatar,
|
|
|
|
|
|
|
|
"send_time": CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
"content": fileName,
|
|
|
|
|
|
|
|
"base64": imgBase64,
|
|
|
|
|
|
|
|
"url": imgUrl,
|
|
|
|
|
|
|
|
"message_type": "ImgMsg",
|
|
|
|
|
|
|
|
"chat_type": sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bodyJsonObj, _ := json.Marshal(cm)
|
|
|
|
|
|
|
|
bodyString := string(bodyJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveErr := ImRelateDao.SaveChatRecord("chat_record", bodyString)
|
|
|
|
|
|
|
|
if saveErr != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "聊天记录保存失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送消息成功!"})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
功能:发送融云文件消息
|
|
|
|
|
|
|
|
作者:吴缤
|
|
|
|
|
|
|
|
日期:2021-08-16
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func sendFileMsg(c *gin.Context) {
|
|
|
|
|
|
|
|
//发送方Id。
|
|
|
|
|
|
|
|
fromId := c.PostForm("fromId")
|
|
|
|
|
|
|
|
//接收方Id。
|
|
|
|
|
|
|
|
toId := c.PostForm("toId")
|
|
|
|
|
|
|
|
//发送类型 p:单聊 g:群聊
|
|
|
|
|
|
|
|
sendType := c.PostForm("sendType")
|
|
|
|
|
|
|
|
//文件名
|
|
|
|
|
|
|
|
fileName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
//文件大小
|
|
|
|
|
|
|
|
fileSize := c.PostForm("fileSize")
|
|
|
|
|
|
|
|
//文件类型
|
|
|
|
|
|
|
|
fileType := c.PostForm("fileType")
|
|
|
|
|
|
|
|
//文件URL
|
|
|
|
|
|
|
|
fileUrl := c.PostForm("fileUrl")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m := map[string]string{"name": fileName, "size": fileSize, "type": fileType, "fileUrl": fileUrl}
|
|
|
|
|
|
|
|
contentJsonObj, _ := json.Marshal(m)
|
|
|
|
|
|
|
|
contentJsonStr := string(contentJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:FileMsg", contentJsonStr)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "发送消息失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fromName := ImRelateDao.GetPersonNameByUserId(fromId)
|
|
|
|
|
|
|
|
fromAvatar := ImRelateDao.GetPersonAvatarByUserId(fromId)
|
|
|
|
|
|
|
|
var toName, toAvatar string
|
|
|
|
|
|
|
|
if sendType == "p" {
|
|
|
|
|
|
|
|
toName = ImRelateDao.GetPersonNameByUserId(toId)
|
|
|
|
|
|
|
|
toAvatar = ImRelateDao.GetPersonAvatarByUserId(toId)
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
toName, toAvatar = ImRelateDao.GetGroupNameAvatarByGroupId(toId)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cm := map[string]string{
|
|
|
|
|
|
|
|
"sender_user_id": fromId,
|
|
|
|
|
|
|
|
"sender_user_name": fromName,
|
|
|
|
|
|
|
|
"sender_user_avatar": fromAvatar,
|
|
|
|
|
|
|
|
"receiver_user_id": toId,
|
|
|
|
|
|
|
|
"receiver_user_name": toName,
|
|
|
|
|
|
|
|
"receiver_user_avatar": toAvatar,
|
|
|
|
|
|
|
|
"send_time": CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
"content": fileName,
|
|
|
|
|
|
|
|
"size": fileSize,
|
|
|
|
|
|
|
|
"file_type": fileType,
|
|
|
|
|
|
|
|
"url": fileUrl,
|
|
|
|
|
|
|
|
"message_type": "FileMsg",
|
|
|
|
|
|
|
|
"chat_type": sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bodyJsonObj, _ := json.Marshal(cm)
|
|
|
|
|
|
|
|
bodyString := string(bodyJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveErr := ImRelateDao.SaveChatRecord("chat_record", bodyString)
|
|
|
|
|
|
|
|
if saveErr != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "聊天记录保存失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送消息成功!"})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
功能:发送融云视频消息
|
|
|
|
|
|
|
|
作者:吴缤
|
|
|
|
|
|
|
|
日期:2021-08-16
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
func sendSightMsg(c *gin.Context) {
|
|
|
|
|
|
|
|
//发送方Id。
|
|
|
|
|
|
|
|
fromId := c.PostForm("fromId")
|
|
|
|
|
|
|
|
//接收方Id。
|
|
|
|
|
|
|
|
toId := c.PostForm("toId")
|
|
|
|
|
|
|
|
//发送类型 p:单聊 g:群聊
|
|
|
|
|
|
|
|
sendType := c.PostForm("sendType")
|
|
|
|
|
|
|
|
//视频URL
|
|
|
|
|
|
|
|
videoUrl := c.PostForm("videoUrl")
|
|
|
|
|
|
|
|
//视频缩略图base64编码
|
|
|
|
|
|
|
|
thumbBase64 := ConfigUtil.VideoThumb
|
|
|
|
|
|
|
|
//视频大小
|
|
|
|
|
|
|
|
videoSize := c.PostForm("videoSize")
|
|
|
|
|
|
|
|
//视频名称
|
|
|
|
|
|
|
|
videoName := c.PostForm("fileName")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m := map[string]string{"sightUrl": videoUrl, "content": thumbBase64, "duration": "60", "size": videoSize, "name": videoName}
|
|
|
|
|
|
|
|
contentJsonObj, _ := json.Marshal(m)
|
|
|
|
|
|
|
|
contentJsonStr := string(contentJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:SightMsg", contentJsonStr)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "发送消息失败!"})
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fromName := ImRelateDao.GetPersonNameByUserId(fromId)
|
|
|
|
|
|
|
|
fromAvatar := ImRelateDao.GetPersonAvatarByUserId(fromId)
|
|
|
|
|
|
|
|
var toName, toAvatar string
|
|
|
|
|
|
|
|
if sendType == "p" {
|
|
|
|
|
|
|
|
toName = ImRelateDao.GetPersonNameByUserId(toId)
|
|
|
|
|
|
|
|
toAvatar = ImRelateDao.GetPersonAvatarByUserId(toId)
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
toName, toAvatar = ImRelateDao.GetGroupNameAvatarByGroupId(toId)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cm := map[string]string{
|
|
|
|
|
|
|
|
"sender_user_id": fromId,
|
|
|
|
|
|
|
|
"sender_user_name": fromName,
|
|
|
|
|
|
|
|
"sender_user_avatar": fromAvatar,
|
|
|
|
|
|
|
|
"receiver_user_id": toId,
|
|
|
|
|
|
|
|
"receiver_user_name": toName,
|
|
|
|
|
|
|
|
"receiver_user_avatar": toAvatar,
|
|
|
|
|
|
|
|
"send_time": CommonUtil.GetCurrentTime(),
|
|
|
|
|
|
|
|
"content": videoName,
|
|
|
|
|
|
|
|
"size": videoSize,
|
|
|
|
|
|
|
|
"base64": thumbBase64,
|
|
|
|
|
|
|
|
"url": videoUrl,
|
|
|
|
|
|
|
|
"message_type": "SightMsg",
|
|
|
|
|
|
|
|
"chat_type": sendType,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bodyJsonObj, _ := json.Marshal(cm)
|
|
|
|
|
|
|
|
bodyString := string(bodyJsonObj)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveErr := ImRelateDao.SaveChatRecord("chat_record", bodyString)
|
|
|
|
saveErr := ImRelateDao.SaveChatRecord("chat_record", bodyString)
|
|
|
|
if saveErr != nil {
|
|
|
|
if saveErr != nil {
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "聊天记录保存失败!"})
|
|
|
|
c.JSON(http.StatusOK, gin.H{"success": false, "info": "聊天记录保存失败!"})
|
|
|
|