This commit is contained in:
yangsiqi1376@163.com
2023-11-02 15:01:08 +08:00
parent d16eb62d0d
commit 74db198aed
2 changed files with 21 additions and 12 deletions

View File

@@ -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 {

View File

@@ -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
})
}