Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -55,38 +55,40 @@ type GetPoiIMStatusReq struct {
|
|||||||
type GetPoiIMStatusResp struct {
|
type GetPoiIMStatusResp struct {
|
||||||
VendorID int `json:"vendorID"`
|
VendorID int `json:"vendorID"`
|
||||||
ImStatus int `json:"imStatus"`
|
ImStatus int `json:"imStatus"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPoiIMStatus 查询门店IM单聊开关状态
|
// GetPoiIMStatus 查询门店IM单聊开关状态
|
||||||
func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp, err error) {
|
func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp) {
|
||||||
|
var (
|
||||||
|
ans1 = &GetPoiIMStatusResp{}
|
||||||
|
ans2 = &GetPoiIMStatusResp{}
|
||||||
|
)
|
||||||
if len(param) == 0 {
|
if len(param) == 0 {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
}
|
||||||
for _, v := range param {
|
for _, v := range param {
|
||||||
switch v.VendorID {
|
switch v.VendorID {
|
||||||
case model.VendorIDMTWM:
|
case model.VendorIDMTWM:
|
||||||
temp, err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, v.VendorOrgCode).(*mtwmapi.API).GetPoiIMStatus(v.VendorStoreID)
|
temp, err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, v.VendorOrgCode).(*mtwmapi.API).GetPoiIMStatus(v.VendorStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
ans1.ErrMsg = fmt.Sprintf("1:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
ans1.VendorID = model.VendorIDMTWM
|
||||||
VendorID: model.VendorIDMTWM,
|
ans1.ImStatus = temp.ImStatus
|
||||||
ImStatus: temp.ImStatus,
|
|
||||||
})
|
|
||||||
case model.VendorIDEBAI:
|
case model.VendorIDEBAI:
|
||||||
//status, err := api.EbaiAPI.GetStoreIMStatus(v.VendorStoreID)
|
|
||||||
status, err := partner.CurAPIManager.GetAPI(model.VendorIDEBAI, v.VendorOrgCode).(*ebaiapi.API).GetStoreIMStatus(v.VendorStoreID)
|
status, err := partner.CurAPIManager.GetAPI(model.VendorIDEBAI, v.VendorOrgCode).(*ebaiapi.API).GetStoreIMStatus(v.VendorStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
ans1.ErrMsg = fmt.Sprintf("3:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
ans2.VendorID = model.VendorIDEBAI
|
||||||
VendorID: model.VendorIDMTWM,
|
ans2.ImStatus = utils.Str2Int(status)
|
||||||
ImStatus: utils.Str2Int(status),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
retVal = append(retVal, ans1, ans2)
|
||||||
return retVal, nil
|
return retVal
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetPoiIMStatusReq struct {
|
type SetPoiIMStatusReq struct {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/im"
|
"git.rosy.net.cn/jx-callback/business/partner/im"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
)
|
)
|
||||||
@@ -100,10 +102,11 @@ func (c *IMController) GetPoiIMStatus() {
|
|||||||
b := bytes.NewBufferString(params.Data)
|
b := bytes.NewBufferString(params.Data)
|
||||||
decoder := json.NewDecoder(b)
|
decoder := json.NewDecoder(b)
|
||||||
if err := decoder.Decode(&req); err == nil {
|
if err := decoder.Decode(&req); err == nil {
|
||||||
retVal, err := im.GetPoiIMStatus(req)
|
retVal := im.GetPoiIMStatus(req)
|
||||||
return retVal, "", err
|
return retVal, "", nil
|
||||||
|
} else {
|
||||||
|
return nil, "", err
|
||||||
}
|
}
|
||||||
return nil, "", nil
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,3 +129,18 @@ func (c *IMController) SetPoiIMStatus() {
|
|||||||
return nil, "", nil
|
return nil, "", nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 获取饿百多媒体链接
|
||||||
|
// @Description 获取饿百多媒体链接
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param platformShopID query string true "饿了么门店id"
|
||||||
|
// @Param mediaID query string true "多媒体资源id"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetElmMedia [get]
|
||||||
|
func (c *IMController) GetElmMedia() {
|
||||||
|
c.callGetElmMedia(func(params *tImGetElmMediaParams) (interface{}, string, error) {
|
||||||
|
retVal, err := api.EbaiAPI.GetMediaUrl(params.PlatformShopID, params.MediaID)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -4515,6 +4515,14 @@ func init() {
|
|||||||
MethodParams: param.Make(),
|
MethodParams: param.Make(),
|
||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:IMController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:IMController"],
|
||||||
|
web.ControllerComments{
|
||||||
|
Method: "GetElmMedia",
|
||||||
|
Router: `/GetElmMedia`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
//web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:FnController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:FnController"],
|
//web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:FnController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:FnController"],
|
||||||
// web.ControllerComments{
|
// web.ControllerComments{
|
||||||
// Method: "FnStore",
|
// Method: "FnStore",
|
||||||
|
|||||||
Reference in New Issue
Block a user