This commit is contained in:
yangsiqi1376@163.com
2023-11-01 15:36:27 +08:00
parent 5f94e94d6d
commit fae888afaf
2 changed files with 35 additions and 6 deletions

View File

@@ -7,11 +7,14 @@ import (
)
const (
IMStoreStatusOnLine = "ONLINE" // 门店im在线状态
IMStoreStatusBusy = "BUSY" // 忙碌状态
IMType = "IM" // 业务类型,消息默认IM
SubTypeDef = "SEND_MESSAGE" // 子业务类型发送消息。默认值SEND_MESSAGE
ReadIMType = "READ_MESSAGE"
IMStoreStatusOnLine = "ONLINE" // 门店im在线状态
IMStoreStatusBusy = "BUSY" // 忙碌状态
IMType = "IM" // 业务类型,消息默认IM
IMTypeSendMsg = "SEND_MESSAGE" //
IMTypeReadMsg = "READ_MESSAGE" //
IMTypeGetMedia = "GET_MEDIA_URL" //
DefaultUrlExpireTime = 86400 //s
//消息类型
ContentTypeNormal = 1 //普通文本信息
@@ -53,6 +56,26 @@ func (a *API) BusinessSendMsg(param *BusinessSendMsgReq) error {
return nil
}
// GetMediaUrl 获取多媒体文件url
func (a *API) GetMediaUrl(platformShopId, mediaID string) (url string, err error) {
result, err := a.AccessAPI("im.get.media.url", map[string]interface{}{
"platformShopId": platformShopId,
"bizType": IMType,
"subBizType": IMTypeGetMedia,
"payload": map[string]interface{}{
"mediaId": mediaID,
"urlExpireTime": DefaultUrlExpireTime,
},
})
if err != nil {
return "", err
}
if result.ErrNo != 0 {
return "", errors.New(result.Error)
}
return result.Data.(map[string]interface{})["url"].(string), nil
}
// GetStoreIMStatus 获取门店的im状态 1开启-1关闭
func (a *API) GetStoreIMStatus(platformShopId string) (string, error) {
result, err := a.AccessAPI("im.getIMStatus", map[string]interface{}{"platformShopId": platformShopId})