From 74db198aedfe9dc36a295cb15faf65c9f0397309 Mon Sep 17 00:00:00 2001 From: "yangsiqi1376@163.com" Date: Thu, 2 Nov 2023 15:01:08 +0800 Subject: [PATCH] 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 }) }