master
kgdxpr 4 years ago
parent 96a59fb947
commit 34f3dff0c0

@ -2,45 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="19c8c37d-a056-451c-a29d-fb612b9a3e2f" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Business/FileRelate/FileRelateController/FileReleateController.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Business/FileRelate/FileRelateDao/FileReleateDao.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/CheckHandler.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitDateTime.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitEmail.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitEmpty.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitFloatRange.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitIdCard.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitIntRange.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitLength.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/CheckHandler/LimitTel.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Handler/ParameterHandler.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Model/Res.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Templates/config" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Templates/struct.go.tpl" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tools/ModelKit.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Tools/XltraSwag.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Utils/CommonUtil/SwaggerUtil.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Utils/SqlKit/Selector.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Utils/SqlKit/SqlKit.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/docs/docs.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/docs/docs.go.template" afterDir="false" />
<change afterPath="$PROJECT_DIR$/docs/swagger.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/docs/swagger.yaml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_clouddisk_tree.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_clouddisk_tree_file.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_dm_system.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_file.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_file_type.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/models/t_zhxy_file_type_ext.go" afterDir="false" />
<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$/Config/Config.ini" beforeDir="false" afterPath="$PROJECT_DIR$/Config/Config.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Router/Router.go" beforeDir="false" afterPath="$PROJECT_DIR$/Router/Router.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Utils/CommonUtil/CommonUtil.go" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/CommonUtil/CommonUtil.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" />
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Utils/ConfigUtil/ConfigUtil.go" beforeDir="false" afterPath="$PROJECT_DIR$/Utils/ConfigUtil/ConfigUtil.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

@ -2,6 +2,7 @@ package ImRelateController
import (
"dsSzxy/Business/ImRelate/ImRelateDao"
"dsSzxy/Utils/ConfigUtil"
"encoding/json"
"github.com/gin-gonic/gin"
"net/http"
@ -12,6 +13,8 @@ func Routers(r *gin.RouterGroup) {
rr := r.Group("/imRelate")
rr.POST("/sendTxtMsg", sendTxtMsg)
rr.POST("/sendImgMsg", sendImgMsg)
rr.POST("/sendFileMsg", sendFileMsg)
rr.POST("/sendVideoMsg", sendVideoMsg)
}
/**
@ -33,12 +36,22 @@ func sendTxtMsg(c *gin.Context) {
contentJsonObj, _ := json.Marshal(m)
contentJsonStr := string(contentJsonObj)
err := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:TxtMsg", contentJsonStr)
if err != nil {
sendErr := ImRelateDao.SendRongYunMsg(sendType, fromId, toId, "RC:TxtMsg", contentJsonStr)
if sendErr != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": "发送消息失败!"})
return
}
cm := map[string]string{"name": "中华人民共和国1234", "country": "China", "age": "21", "date": "2021-08-17"}
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": "发送消息成功!"})
}
@ -73,3 +86,71 @@ func sendImgMsg(c *gin.Context) {
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
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送消息成功!"})
}
/**
2021-08-16
*/
func sendVideoMsg(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")
//视频名称
fileName := c.PostForm("fileName")
m := map[string]string{"sightUrl": videoUrl, "content": thumbBase64, "duration": "60", "size": videoSize, "name": fileName}
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
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送消息成功!"})
}

@ -3,6 +3,7 @@ package ImRelateDao
import (
"dsSzxy/Utils/CommonUtil"
"dsSzxy/Utils/ConfigUtil"
"dsSzxy/Utils/EsUtil"
ssdb "dsSzxy/Utils/SsdbUtil"
"errors"
"fmt"
@ -39,6 +40,10 @@ func GetPersonAvatar(personId string, identityId string, w string, h string) str
return avatar
}
func GetPersonName(personId string, identityId string) string {
return ""
}
/**
@ -106,3 +111,23 @@ func SendRongYunMsg(sendType string, fromId string, toId string, objectName stri
return nil
}
/**
ES
2021-08-17
*/
func SaveChatRecord(indexName string, bodyString string) error {
esClient := EsUtil.EsClient
CTX := EsUtil.CTX
_, err := esClient.Index().
Index(indexName).
Id(CommonUtil.GetUUID()).
BodyString(bodyString).
Do(CTX)
if err != nil {
return err
}
return nil
}

File diff suppressed because one or more lines are too long

@ -63,6 +63,9 @@ var (
//kafka地址
KafkaAddrs string
//视频缩略图
VideoThumb string
)
//cookie中的SessionId名称
@ -153,6 +156,9 @@ func init() {
//kafka地址
KafkaAddrs = iniParser.GetString("kafka", "addr")
//视频缩略图
VideoThumb = iniParser.GetString("videoThumb", "thumb")
}
type IniParser struct {

Loading…
Cancel
Save