1
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
@@ -28,8 +28,7 @@ func SendVendorV2(data SendData, vendorOrgCode string) (err error) {
|
||||
dataStr, _ := json.Marshal(data.Data)
|
||||
temp := string(dataStr)
|
||||
globals.SugarLogger.Debugf("SendVendorV2 temp=%s", temp)
|
||||
//if _, err = api.MtwmAPI.MsgSend(string(dataStr)); err != nil {
|
||||
if _, err = partner.CurAPIManager.GetAPI(model.VendorIDMTWM, vendorOrgCode).(*mtwmapi.API).MsgSend(string(dataStr)); err != nil {
|
||||
if err = mtwm.MsgSend(vendorOrgCode, string(dataStr)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -43,6 +42,17 @@ func SendVendorV2(data SendData, vendorOrgCode string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPoiIMStatus 查询门店IM单聊开关状态
|
||||
func GetPoiIMStatus(vendorID int, vendorStoreID, vendorOrgCode string) (retVal interface{}, err error) {
|
||||
switch vendorID {
|
||||
case model.VendorIDMTWM:
|
||||
retVal, err = mtwm.GetPoiIMStatus(vendorStoreID, vendorOrgCode)
|
||||
case model.VendorIDEBAI:
|
||||
//retVal,err=
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ReadMsgFromClient 存储客户端发送的消息
|
||||
func ReadMsgFromClient(vendorID int, elmAppID string, msg interface{}) error {
|
||||
var (
|
||||
@@ -135,10 +145,13 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error {
|
||||
LatestTime: PushContentReq.Cts,
|
||||
OrderID: "",
|
||||
}
|
||||
globals.SugarLogger.Debugf("ReadMsgFromVendor PushContentReq.OrderID=%d", PushContentReq.OrderID)
|
||||
|
||||
vendorStoreID = PushContentReq.AppPoiCode
|
||||
if PushContentReq.OrderID != 0 {
|
||||
userList.OrderID = utils.Int2Str(PushContentReq.OrderID)
|
||||
}
|
||||
globals.SugarLogger.Debugf("ReadMsgFromVendor userList=%s", utils.Format4Output(userList, false))
|
||||
}
|
||||
if vendorID == VendorIDELM {
|
||||
var ElmData = ebaiapi.ImMessageSend{}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package partner
|
||||
|
||||
//
|
||||
//import (
|
||||
// "fmt"
|
||||
//
|
||||
// "git.rosy.net.cn/jx-callback/business/model"
|
||||
//)
|
||||
//
|
||||
//type IImHandler interface {
|
||||
// GetVendorID() int
|
||||
//}
|
||||
//
|
||||
//var (
|
||||
// ImPlatformHandlers map[int]IImHandler
|
||||
//)
|
||||
//
|
||||
//func init() {
|
||||
// ImPlatformHandlers = make(map[int]IImHandler)
|
||||
//}
|
||||
//
|
||||
//func RegisterImPlatform(handler IImHandler) {
|
||||
// vendorID := handler.GetVendorID()
|
||||
// if !(model.IsImVendorExist(vendorID)) {
|
||||
// panic(fmt.Sprintf("Im vendor:%d is illegal", vendorID))
|
||||
// }
|
||||
// if _, ok := ImPlatformHandlers[vendorID]; ok {
|
||||
// panic(fmt.Sprintf("Im vendor:%d, already exists", vendorID))
|
||||
// }
|
||||
// ImPlatformHandlers[vendorID] = handler
|
||||
//}
|
||||
//
|
||||
//func GetImPlatformFromVendorID(vendorID int) IImHandler {
|
||||
// return ImPlatformHandlers[vendorID]
|
||||
//}
|
||||
@@ -20,3 +20,15 @@ func (p *PurchaseHandler) OnImMessage(msg *ebaiapi.CallbackMsg) (response *ebaia
|
||||
//return nil
|
||||
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, err, nil)
|
||||
}
|
||||
|
||||
// GetStoreIMStatus 查询门店IM开关状态
|
||||
func GetStoreIMStatus(platformShopId string) (string, error) {
|
||||
retVal, err := api.EbaiAPI.GetStoreIMStatus(platformShopId)
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
// UpdateIMStatus 更新店铺IM开关状态 1-开启,-1-关闭
|
||||
func UpdateIMStatus(platformShopId string, status int) error {
|
||||
err := api.EbaiAPI.UpdateIMStatus(platformShopId, status)
|
||||
return err
|
||||
}
|
||||
|
||||
21
business/partner/purchase/mtwm/im.go
Normal file
21
business/partner/purchase/mtwm/im.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package mtwm
|
||||
|
||||
import "git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
|
||||
// GetPoiIMStatus 查询门店IM单聊开关状态
|
||||
func GetPoiIMStatus(appPoiCode, vendorOrgCode string) (retVal mtwmapi.GetPoiIMStatusResp, err error) {
|
||||
retVal, err = getAPI(vendorOrgCode, 0, appPoiCode).GetPoiIMStatus(appPoiCode)
|
||||
return retVal, err
|
||||
}
|
||||
|
||||
// SetPoiIMStatus 设置门店IM线上状态 0-关闭 1-开启
|
||||
func SetPoiIMStatus(appPoiCode, vendorOrgCode string, imStatus int) error {
|
||||
err := getAPI(vendorOrgCode, 0, appPoiCode).SetPoiIMStatus(appPoiCode, imStatus)
|
||||
return err
|
||||
}
|
||||
|
||||
// MsgSend 向用户发送消息
|
||||
func MsgSend(vendorOrgCode, msg string) error {
|
||||
_, err := getAPI(vendorOrgCode, 0, "").MsgSend(msg)
|
||||
return err
|
||||
}
|
||||
@@ -5,11 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/im"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
@@ -103,9 +99,7 @@ func (c *IMController) SendToVendorV2() {
|
||||
// @router /GetPoiIMStatus [get]
|
||||
func (c *IMController) GetPoiIMStatus() {
|
||||
c.callGetPoiIMStatus(func(params *tImGetPoiIMStatusParams) (interface{}, string, error) {
|
||||
var api = partner.CurAPIManager.GetAPI(model.VendorIDMTWM, params.VendorOrgCode).(*mtwmapi.API)
|
||||
globals.SugarLogger.Debugf("GetPoiIMStatus appID=%s", api.GetAppID())
|
||||
retVal, err := api.GetPoiIMStatus(params.AppPoiCode)
|
||||
retVal, err := mtwm.GetPoiIMStatus(params.AppPoiCode, params.VendorOrgCode)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
@@ -121,8 +115,7 @@ func (c *IMController) GetPoiIMStatus() {
|
||||
// @router /SetPoiIMStatus [post]
|
||||
func (c *IMController) SetPoiIMStatus() {
|
||||
c.callSetPoiIMStatus(func(params *tImSetPoiIMStatusParams) (interface{}, string, error) {
|
||||
//err := api.MtwmAPI.SetPoiIMStatus(params.AppPoiCode, params.ImStatus)
|
||||
err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, params.VendorOrgCode).(*mtwmapi.API).SetPoiIMStatus(params.AppPoiCode, params.ImStatus)
|
||||
err := mtwm.SetPoiIMStatus(params.AppPoiCode, params.VendorOrgCode, params.ImStatus)
|
||||
return nil, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user