Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop

This commit is contained in:
邹宗楠
2023-09-25 18:36:07 +08:00
5 changed files with 56 additions and 2 deletions

View File

@@ -526,6 +526,11 @@ func IsPrinterVendorExist(vendorID int) bool {
return ok && vendorID >= VendorIDPrinterBegin && vendorID <= VendorIDPrinterEnd
}
func IsImVendorExist(vendorID int) bool {
_, ok := VendorNames[vendorID]
return ok && vendorID >= VendorIDPurchaseBegin && vendorID <= VendorIDPurchaseEnd
}
func IsOrderLockStatus(status int) bool {
return status == OrderStatusLocked || status == OrderStatusApplyCancel
}

View File

@@ -69,7 +69,13 @@ func ReadMsgFromClient(vendorID int, elmAppID string, msg interface{}) error {
UserID: utils.Int2Str(pushContent.OpenUserID),
LatestMsg: pushContent.MsgContent,
LatestTime: pushContent.Cts,
OrderID: "",
}
globals.SugarLogger.Debugf("ReadMsgFromClient pushContent.OrderID=%d", pushContent.OrderID)
if pushContent.OrderID != 0 {
userList.OrderID = utils.Int2Str(pushContent.OrderID)
}
globals.SugarLogger.Debugf("ReadMsgFromClient userList=%s", utils.Format4Output(userList, false))
}
if vendorID == VendorIDELM {
var ElmData = ebaiapi.ImMessageSend{}
@@ -127,8 +133,12 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error {
UserID: utils.Int2Str(PushContentReq.OpenUserID),
LatestMsg: PushContentReq.MsgContent,
LatestTime: PushContentReq.Cts,
OrderID: "",
}
vendorStoreID = PushContentReq.AppPoiCode
if PushContentReq.OrderID != 0 {
userList.OrderID = utils.Int2Str(PushContentReq.OrderID)
}
}
if vendorID == VendorIDELM {
var ElmData = ebaiapi.ImMessageSend{}

View File

@@ -22,6 +22,7 @@ type JXMsg struct {
type UserMessageList struct {
VendorID int `json:"vendorID"` //平台品牌 1-美团 3-饿了么
UserID string `json:"userID"` //用户ID
OrderID string `json:"orderID"` //已下单才有
NewMessageNum int `json:"NewMessageNum"` //新消息数量
LatestMsg string `json:"latestMsg"` //最新一条消息
LatestTime int `json:"latestTime"` //最新一条消息发送时间

View File

@@ -0,0 +1,35 @@
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]
//}

View File

@@ -5,6 +5,8 @@ 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"
@@ -101,8 +103,9 @@ func (c *IMController) SendToVendorV2() {
// @router /GetPoiIMStatus [get]
func (c *IMController) GetPoiIMStatus() {
c.callGetPoiIMStatus(func(params *tImGetPoiIMStatusParams) (interface{}, string, error) {
//retVal, err := api.MtwmAPI.GetPoiIMStatus(params.AppPoiCode)
retVal, err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, params.VendorOrgCode).(*mtwmapi.API).GetPoiIMStatus(params.AppPoiCode)
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)
return retVal, "", err
})
}