master
黄海 4 years ago
parent d4e3f10f91
commit 0f465238d5

@ -1,267 +1,4 @@
<<<<<<< HEAD
package ImRelateController
import (
"dsSzxy/Business/ImRelate/ImRelateDao"
"dsSzxy/Utils/CommonUtil"
"dsSzxy/Utils/ConfigUtil"
"encoding/json"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
//模块的路由配置
func Routers(r *gin.RouterGroup) {
rr := r.Group("/imRelate")
rr.POST("/SaveChatRecord", SaveChatRecord)
rr.POST("/GetPersonAvatar", GetPersonAvatar)
rr.GET("/GetPersonInfoList", GetPersonInfoList)
rr.POST("/CreateGroup", CreateGroup)
rr.POST("/SyncRongYunUser", SyncRongYunUser)
rr.POST("/SendSystemMsg", SendSystemMsg)
}
/**
2021-09-17
*/
func SendSystemMsg(c *gin.Context) {
//发送方Id。
fromId := c.PostForm("fromId")
//接收方Id。
toId := c.PostForm("toId")
//内容
content := c.PostForm("content")
err := ImRelateDao.SendSystemMsg(fromId, toId, content)
if err != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "发送系统成功!"})
}
/**
2021-08-23
*/
func SaveChatRecord(c *gin.Context) {
//发送方Id。
fromId := c.PostForm("fromId")
//接收方Id。
toId := c.PostForm("toId")
//发送类型 p单聊 g群聊
sendType := c.PostForm("sendType")
//获取姓名和头像
fromName, fromAvatar, toName, toAvatar := ImRelateDao.GetPersonNameAvatar(fromId, toId, sendType)
var crs ImRelateDao.ChatRecordStruct
objectName := c.PostForm("objectName")
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")
//图片Url
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
}
bodyJsonObj, _ := json.Marshal(crs)
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-23
*/
func GetPersonAvatar(c *gin.Context) {
var personAvatar []map[string]string
personIds := c.PostForm("personIds")
personIdArr := strings.Split(personIds, ",")
//获取是云版还是局版
serverLocation := ImRelateDao.GetServerLocation()
for _, val := range personIdArr {
id := val + "_5"
avatar := ImRelateDao.GetPersonAvatarByUserId(id, serverLocation)
myMap := map[string]string{val: avatar}
personAvatar = append(personAvatar, myMap)
}
josnByte, _ := json.Marshal(personAvatar)
c.JSON(http.StatusOK, gin.H{"success": true, "list": CommonUtil.ConvertJsonStringToMapArray(string(josnByte))})
}
/**
2021-09-06
*/
func GetPersonInfoList(c *gin.Context) {
bureauId := c.Query("bureau_id")
orgId := c.Query("org_id")
queryChild := c.Query("query_child")
bUse := c.Query("b_use")
personName := c.Query("person_name")
queryBureauChild := c.Query("query_bureau_child")
pageNumber := c.Query("pageNumber")
pageSize := c.Query("pageSize")
res, err := ImRelateDao.GetPersonList(bureauId, orgId, queryChild, bUse, personName, queryBureauChild, pageNumber, pageSize)
if err != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": "获取人员信息列表失败!"})
return
}
jsonObj, _ := CommonUtil.JsonStringToMap(res)
c.JSON(http.StatusOK, jsonObj)
}
/**
2021-09-07
*/
func SyncRongYunUser(c *gin.Context) {
//用户ID。
personId := c.PostForm("personId")
personName := c.PostForm("personName")
identityId := c.PostForm("identityId")
_, err := ImRelateDao.RongYunGetToken(personId, identityId, personName, "")
if err != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": "向融云同步用户失败!"})
return
}
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": "成功!"})
}
=======
package ImRelateController
import (
@ -271,13 +8,14 @@ import (
"encoding/json"
"github.com/gin-gonic/gin"
"net/http"
"strings"
)
//模块的路由配置
func Routers(r *gin.RouterGroup) {
rr := r.Group("/imRelate")
rr.POST("/SaveChatRecord", SaveChatRecord)
rr.GET("/GetPersonAvatar", GetPersonAvatar)
rr.POST("/GetPersonAvatar", GetPersonAvatar)
rr.GET("/GetPersonInfoList", GetPersonInfoList)
rr.POST("/CreateGroup", CreateGroup)
rr.POST("/SyncRongYunUser", SyncRongYunUser)
@ -292,14 +30,11 @@ func Routers(r *gin.RouterGroup) {
func SendSystemMsg(c *gin.Context) {
//发送方Id。
fromId := c.PostForm("fromId")
//接收方Id
//接收方Id
toId := c.PostForm("toId")
//内容
content := c.PostForm("content")
//toIdArr := strings.Split(toIds, ",")
//for _, v := range toIdArr {
//}
err := ImRelateDao.SendSystemMsg(fromId, toId, content)
if err != nil {
@ -438,10 +173,19 @@ func SaveChatRecord(c *gin.Context) {
2021-08-23
*/
func GetPersonAvatar(c *gin.Context) {
userId := c.Query("userId")
avatar := ImRelateDao.GetPersonAvatarByUserId(userId)
personName := ImRelateDao.GetPersonNameByUserId(userId)
c.JSON(http.StatusOK, gin.H{"success": true, "person_name": personName, "avatar": avatar})
var personAvatar []map[string]string
personIds := c.PostForm("personIds")
personIdArr := strings.Split(personIds, ",")
//获取是云版还是局版
serverLocation := ImRelateDao.GetServerLocation()
for _, val := range personIdArr {
id := val + "_5"
avatar := ImRelateDao.GetPersonAvatarByUserId(id, serverLocation)
myMap := map[string]string{val: avatar}
personAvatar = append(personAvatar, myMap)
}
josnByte, _ := json.Marshal(personAvatar)
c.JSON(http.StatusOK, gin.H{"success": true, "list": CommonUtil.ConvertJsonStringToMapArray(string(josnByte))})
}
/**
@ -517,4 +261,3 @@ func CreateGroup(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"success": true, "info": "成功!"})
}
>>>>>>> 7ddb92da53f4ab974837e4dbf4d229b1b3daf22a

File diff suppressed because it is too large Load Diff

@ -1,60 +1,111 @@
module dsSzxy
go 1.16
require (
gitee.com/aesoper/cache v0.0.0-20210525090400-5745f2c3bd94
gitee.com/aesoper/captchaStore v0.0.0-20200527033950-8d788c0d271e
github.com/ChengjinWu/gojson v0.0.0-20181113073026-04749cc2d015 // indirect
github.com/Chronokeeper/anyxml v0.0.0-20160530174208-54457d8e98c6 // indirect
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/CloudyKit/jet v2.1.2+incompatible // indirect
github.com/DataDog/zstd v1.3.5 // indirect
github.com/OwnLocal/goes v1.0.0 // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee // indirect
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/astaxie/beego v1.12.3 // indirect
github.com/bluesky335/IDCheck v0.0.0-20210208025941-aaa5c64e4fa1 // indirect
github.com/bndr/gotabulate v1.1.2 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/disintegration/imaging v1.6.2
github.com/fatih/structs v1.1.0 // indirect
github.com/gin-gonic/gin v1.7.4
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-redis/redis/v7 v7.4.1 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/golang/snappy v0.0.4 // indirect
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/minio/minio-go/v6 v6.0.57
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/mojocn/base64Captcha v1.3.1
github.com/olivere/elastic/v7 v7.0.27
github.com/pkg/sftp v1.13.1
github.com/rongcloud/server-sdk-go/v3 v3.2.5 // indirect
github.com/satori/go.uuid v1.2.0
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 // indirect
github.com/spf13/viper v1.8.1
github.com/swaggo/gin-swagger v1.3.1 // indirect
github.com/swaggo/swag v1.7.1 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tealeg/xlsx v1.0.5 // indirect
github.com/ugorji/go v1.2.6 // indirect
github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be // indirect
github.com/xormplus/xorm v0.0.0-20210512135344-8123d584d5f5
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
golang.org/x/sys v0.0.0-20210816032535-30e4713e60e3 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect
gopkg.in/ini.v1 v1.62.0
)
module dsSzxy
go 1.17
require (
gitee.com/aesoper/cache v0.0.0-20210525090400-5745f2c3bd94
gitee.com/aesoper/captchaStore v0.0.0-20200527033950-8d788c0d271e
github.com/Shopify/sarama v1.29.1
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/astaxie/beego v1.12.3
github.com/bluesky335/IDCheck v0.0.0-20210208025941-aaa5c64e4fa1
github.com/disintegration/imaging v1.6.2
github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.7.4
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-sql-driver/mysql v1.6.0
github.com/iancoleman/orderedmap v0.2.0
github.com/minio/minio-go/v6 v6.0.57
github.com/mojocn/base64Captcha v1.3.1
github.com/olivere/elastic/v7 v7.0.27
github.com/pkg/sftp v1.13.1
github.com/rongcloud/server-sdk-go/v3 v3.2.5
github.com/satori/go.uuid v1.2.0
github.com/spf13/viper v1.8.1
github.com/swaggo/gin-swagger v1.3.1
github.com/swaggo/swag v1.7.1
github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be
github.com/xormplus/xorm v0.0.0-20210512135344-8123d584d5f5
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
gopkg.in/ini.v1 v1.62.0
)
require (
github.com/Chronokeeper/anyxml v0.0.0-20160530174208-54457d8e98c6 // indirect
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/CloudyKit/jet v2.1.2+incompatible // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee // indirect
github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 // indirect
github.com/bndr/gotabulate v1.1.2 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/clbanning/mxj v1.8.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/go-redis/redis/v8 v8.8.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.0.0 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.12.2 // indirect
github.com/klauspost/cpuid v1.2.3 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/minio/md5-simd v1.1.0 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tealeg/xlsx v1.0.5 // indirect
github.com/ugorji/go/codec v1.2.6 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
go.opentelemetry.io/otel/metric v0.20.0 // indirect
go.opentelemetry.io/otel/trace v0.20.0 // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d // indirect
golang.org/x/sys v0.0.0-20210816032535-30e4713e60e3 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save