Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -53,40 +53,42 @@ type GetPoiIMStatusReq struct {
|
||||
}
|
||||
|
||||
type GetPoiIMStatusResp struct {
|
||||
VendorID int `json:"vendorID"`
|
||||
ImStatus int `json:"imStatus"`
|
||||
VendorID int `json:"vendorID"`
|
||||
ImStatus int `json:"imStatus"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
for _, v := range param {
|
||||
switch v.VendorID {
|
||||
case model.VendorIDMTWM:
|
||||
temp, err := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, v.VendorOrgCode).(*mtwmapi.API).GetPoiIMStatus(v.VendorStoreID)
|
||||
if err != nil {
|
||||
ans1.ErrMsg = fmt.Sprintf("1:%v", err)
|
||||
continue
|
||||
}
|
||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
||||
VendorID: model.VendorIDMTWM,
|
||||
ImStatus: temp.ImStatus,
|
||||
})
|
||||
ans1.VendorID = model.VendorIDMTWM
|
||||
ans1.ImStatus = temp.ImStatus
|
||||
case model.VendorIDEBAI:
|
||||
//status, err := api.EbaiAPI.GetStoreIMStatus(v.VendorStoreID)
|
||||
status, err := partner.CurAPIManager.GetAPI(model.VendorIDEBAI, v.VendorOrgCode).(*ebaiapi.API).GetStoreIMStatus(v.VendorStoreID)
|
||||
if err != nil {
|
||||
ans1.ErrMsg = fmt.Sprintf("3:%v", err)
|
||||
continue
|
||||
}
|
||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
||||
VendorID: model.VendorIDMTWM,
|
||||
ImStatus: utils.Str2Int(status),
|
||||
})
|
||||
ans2.VendorID = model.VendorIDEBAI
|
||||
ans2.ImStatus = utils.Str2Int(status)
|
||||
}
|
||||
}
|
||||
|
||||
return retVal, nil
|
||||
retVal = append(retVal, ans1, ans2)
|
||||
return retVal
|
||||
}
|
||||
|
||||
type SetPoiIMStatusReq struct {
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/im"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
)
|
||||
@@ -100,10 +102,11 @@ func (c *IMController) GetPoiIMStatus() {
|
||||
b := bytes.NewBufferString(params.Data)
|
||||
decoder := json.NewDecoder(b)
|
||||
if err := decoder.Decode(&req); err == nil {
|
||||
retVal, err := im.GetPoiIMStatus(req)
|
||||
return retVal, "", err
|
||||
retVal := im.GetPoiIMStatus(req)
|
||||
return retVal, "", nil
|
||||
} else {
|
||||
return nil, "", err
|
||||
}
|
||||
return nil, "", nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -126,3 +129,18 @@ func (c *IMController) SetPoiIMStatus() {
|
||||
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(),
|
||||
Filters: 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.ControllerComments{
|
||||
// Method: "FnStore",
|
||||
|
||||
Reference in New Issue
Block a user