This commit is contained in:
richboo111
2023-06-16 17:33:51 +08:00
parent 64e4339aeb
commit 061baad58f
9 changed files with 109 additions and 798 deletions

View File

@@ -13,15 +13,6 @@ type IMController struct {
web.Controller
}
// @Title IM初始化长链接
// @Description IM初始化长链接
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /StartWebSocket [get]
func (c *IMController) StartWebSocket() {
im.Run(c.Ctx.ResponseWriter, c.Ctx.Request)
}
// @Title IM获取门店用户聊天列表
// @Description IM获取门店用户聊天列表
// @Param token header string true "认证token"
@@ -73,24 +64,24 @@ func (c *IMController) SetImMsgRead() {
})
}
// @Title 向平台商发送信息
// @Description 向平台商发送信息
// @Title 向平台商发送信息(https方式)
// @Description 向平台商发送信息(https方式)
// @Param token header string true "认证token"
// @Param sendData formData string true "平台商消息结构体"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SendToVendor [post]
func (c *IMController) SendToVendor() {
c.callSendToVendor(func(params *tImSendToVendorParams) (retVal interface{}, errCode string, err error) {
// @router /SendToVendorV2 [post]
func (c *IMController) SendToVendorV2() {
c.callSendToVendorV2(func(params *tImSendToVendorV2Params) (retVal interface{}, errCode string, err error) {
var sendData im.SendData
b := bytes.NewBufferString(params.SendData)
decoder := json.NewDecoder(b)
_ = decoder.Decode(&sendData)
fmt.Println(sendData)
if dataStr, err := json.Marshal(sendData); err == nil {
im.SendToVendor(dataStr)
if err = decoder.Decode(&sendData); err == nil {
fmt.Println(sendData)
if err = im.SendVendorV2(sendData); err != nil {
return nil, "", err
}
}
return nil, "", err
return nil, "", nil
})
}