1
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user