From f5ee3b570731cc602d4a68dc0c349c690faa4cfd Mon Sep 17 00:00:00 2001 From: "yangsiqi1376@163.com" Date: Wed, 1 Nov 2023 15:34:28 +0800 Subject: [PATCH 1/4] 1 --- controllers/im.go | 17 +++++++++++++++++ routers/commentsRouter_controllers.go | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/controllers/im.go b/controllers/im.go index 67ee1a5a5..793b27907 100644 --- a/controllers/im.go +++ b/controllers/im.go @@ -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" ) @@ -126,3 +128,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 + }) +} diff --git a/routers/commentsRouter_controllers.go b/routers/commentsRouter_controllers.go index 0442548f8..95a0cd539 100644 --- a/routers/commentsRouter_controllers.go +++ b/routers/commentsRouter_controllers.go @@ -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", From 74db198aedfe9dc36a295cb15faf65c9f0397309 Mon Sep 17 00:00:00 2001 From: "yangsiqi1376@163.com" Date: Thu, 2 Nov 2023 15:01:08 +0800 Subject: [PATCH 2/4] 1 --- business/partner/im/im.go | 26 +++++++++++++++++--------- controllers/im.go | 7 ++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/business/partner/im/im.go b/business/partner/im/im.go index 5d4300595..82ff49b55 100644 --- a/business/partner/im/im.go +++ b/business/partner/im/im.go @@ -58,35 +58,43 @@ type GetPoiIMStatusResp struct { } // GetPoiIMStatus 查询门店IM单聊开关状态 -func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp, err error) { +func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp, hint string) { + var ( + errList errlist.ErrList + 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 { + errList.AddErr(fmt.Errorf("1:%v", err)) continue } - retVal = append(retVal, &GetPoiIMStatusResp{ + ans1 = &GetPoiIMStatusResp{ VendorID: model.VendorIDMTWM, ImStatus: temp.ImStatus, - }) + } + //retVal = append(retVal, ans1) 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 { + errList.AddErr(fmt.Errorf("3:%v", err)) continue } - retVal = append(retVal, &GetPoiIMStatusResp{ + ans2 = &GetPoiIMStatusResp{ VendorID: model.VendorIDMTWM, ImStatus: utils.Str2Int(status), - }) + } + //retVal = append(retVal, ans2) } } - - return retVal, nil + retVal = append(retVal, ans1, ans2) + return retVal, fmt.Sprintf("%s", errList.GetErrListAsOne()) } type SetPoiIMStatusReq struct { diff --git a/controllers/im.go b/controllers/im.go index 793b27907..a6c8b1496 100644 --- a/controllers/im.go +++ b/controllers/im.go @@ -102,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, hint := im.GetPoiIMStatus(req) + return retVal, hint, nil + } else { + return nil, "", err } - return nil, "", nil }) } From 75c6cf88bf88fee179315025b35a95041dfd14b9 Mon Sep 17 00:00:00 2001 From: "yangsiqi1376@163.com" Date: Thu, 2 Nov 2023 15:17:42 +0800 Subject: [PATCH 3/4] 1 --- business/partner/im/im.go | 34 ++++++++++++++-------------------- controllers/im.go | 4 ++-- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/business/partner/im/im.go b/business/partner/im/im.go index 82ff49b55..cae9636b8 100644 --- a/business/partner/im/im.go +++ b/business/partner/im/im.go @@ -53,48 +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, hint string) { +func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp) { var ( - errList errlist.ErrList - ans1 = &GetPoiIMStatusResp{} - ans2 = &GetPoiIMStatusResp{} + ans1 = &GetPoiIMStatusResp{} + ans2 = &GetPoiIMStatusResp{} ) if len(param) == 0 { - return 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 { - errList.AddErr(fmt.Errorf("1:%v", err)) + ans1.ErrMsg = fmt.Sprintf("1:%v", err) continue } - ans1 = &GetPoiIMStatusResp{ - VendorID: model.VendorIDMTWM, - ImStatus: temp.ImStatus, - } - //retVal = append(retVal, ans1) + ans1.VendorID = model.VendorIDMTWM + ans1.ImStatus = temp.ImStatus case model.VendorIDEBAI: status, err := partner.CurAPIManager.GetAPI(model.VendorIDEBAI, v.VendorOrgCode).(*ebaiapi.API).GetStoreIMStatus(v.VendorStoreID) if err != nil { - errList.AddErr(fmt.Errorf("3:%v", err)) + ans1.ErrMsg = fmt.Sprintf("3:%v", err) continue } - ans2 = &GetPoiIMStatusResp{ - VendorID: model.VendorIDMTWM, - ImStatus: utils.Str2Int(status), - } - //retVal = append(retVal, ans2) + ans2.VendorID = model.VendorIDMTWM + ans2.ImStatus = utils.Str2Int(status) } } retVal = append(retVal, ans1, ans2) - return retVal, fmt.Sprintf("%s", errList.GetErrListAsOne()) + return retVal } type SetPoiIMStatusReq struct { diff --git a/controllers/im.go b/controllers/im.go index a6c8b1496..36d53d121 100644 --- a/controllers/im.go +++ b/controllers/im.go @@ -102,8 +102,8 @@ func (c *IMController) GetPoiIMStatus() { b := bytes.NewBufferString(params.Data) decoder := json.NewDecoder(b) if err := decoder.Decode(&req); err == nil { - retVal, hint := im.GetPoiIMStatus(req) - return retVal, hint, nil + retVal := im.GetPoiIMStatus(req) + return retVal, "", nil } else { return nil, "", err } From bbdfabd2b69a37bb2ea8a9f30afa242e994d35f6 Mon Sep 17 00:00:00 2001 From: "yangsiqi1376@163.com" Date: Thu, 2 Nov 2023 15:23:44 +0800 Subject: [PATCH 4/4] 1 --- business/partner/im/im.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/im/im.go b/business/partner/im/im.go index cae9636b8..228c1adfc 100644 --- a/business/partner/im/im.go +++ b/business/partner/im/im.go @@ -83,7 +83,7 @@ func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp) { ans1.ErrMsg = fmt.Sprintf("3:%v", err) continue } - ans2.VendorID = model.VendorIDMTWM + ans2.VendorID = model.VendorIDEBAI ans2.ImStatus = utils.Str2Int(status) } }