1
This commit is contained in:
@@ -58,35 +58,43 @@ type GetPoiIMStatusResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPoiIMStatus 查询门店IM单聊开关状态
|
// 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 {
|
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 {
|
||||||
|
errList.AddErr(fmt.Errorf("1:%v", err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
ans1 = &GetPoiIMStatusResp{
|
||||||
VendorID: model.VendorIDMTWM,
|
VendorID: model.VendorIDMTWM,
|
||||||
ImStatus: temp.ImStatus,
|
ImStatus: temp.ImStatus,
|
||||||
})
|
}
|
||||||
|
//retVal = append(retVal, ans1)
|
||||||
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 {
|
||||||
|
errList.AddErr(fmt.Errorf("3:%v", err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
retVal = append(retVal, &GetPoiIMStatusResp{
|
ans2 = &GetPoiIMStatusResp{
|
||||||
VendorID: model.VendorIDMTWM,
|
VendorID: model.VendorIDMTWM,
|
||||||
ImStatus: utils.Str2Int(status),
|
ImStatus: utils.Str2Int(status),
|
||||||
})
|
}
|
||||||
|
//retVal = append(retVal, ans2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
retVal = append(retVal, ans1, ans2)
|
||||||
return retVal, nil
|
return retVal, fmt.Sprintf("%s", errList.GetErrListAsOne())
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetPoiIMStatusReq struct {
|
type SetPoiIMStatusReq struct {
|
||||||
|
|||||||
@@ -102,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, hint := im.GetPoiIMStatus(req)
|
||||||
return retVal, "", err
|
return retVal, hint, nil
|
||||||
|
} else {
|
||||||
|
return nil, "", err
|
||||||
}
|
}
|
||||||
return nil, "", nil
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user