1
This commit is contained in:
@@ -53,48 +53,42 @@ type GetPoiIMStatusReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetPoiIMStatusResp struct {
|
type GetPoiIMStatusResp struct {
|
||||||
VendorID int `json:"vendorID"`
|
VendorID int `json:"vendorID"`
|
||||||
ImStatus int `json:"imStatus"`
|
ImStatus int `json:"imStatus"`
|
||||||
|
ErrMsg string `json:"errMsg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPoiIMStatus 查询门店IM单聊开关状态
|
// GetPoiIMStatus 查询门店IM单聊开关状态
|
||||||
func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp, hint string) {
|
func GetPoiIMStatus(param []GetPoiIMStatusReq) (retVal []*GetPoiIMStatusResp) {
|
||||||
var (
|
var (
|
||||||
errList errlist.ErrList
|
ans1 = &GetPoiIMStatusResp{}
|
||||||
ans1 = &GetPoiIMStatusResp{}
|
ans2 = &GetPoiIMStatusResp{}
|
||||||
ans2 = &GetPoiIMStatusResp{}
|
|
||||||
)
|
)
|
||||||
if len(param) == 0 {
|
if len(param) == 0 {
|
||||||
return 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))
|
ans1.ErrMsg = fmt.Sprintf("1:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ans1 = &GetPoiIMStatusResp{
|
ans1.VendorID = model.VendorIDMTWM
|
||||||
VendorID: model.VendorIDMTWM,
|
ans1.ImStatus = temp.ImStatus
|
||||||
ImStatus: temp.ImStatus,
|
|
||||||
}
|
|
||||||
//retVal = append(retVal, ans1)
|
|
||||||
case model.VendorIDEBAI:
|
case model.VendorIDEBAI:
|
||||||
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))
|
ans1.ErrMsg = fmt.Sprintf("3:%v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ans2 = &GetPoiIMStatusResp{
|
ans2.VendorID = model.VendorIDMTWM
|
||||||
VendorID: model.VendorIDMTWM,
|
ans2.ImStatus = utils.Str2Int(status)
|
||||||
ImStatus: utils.Str2Int(status),
|
|
||||||
}
|
|
||||||
//retVal = append(retVal, ans2)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
retVal = append(retVal, ans1, ans2)
|
retVal = append(retVal, ans1, ans2)
|
||||||
return retVal, fmt.Sprintf("%s", errList.GetErrListAsOne())
|
return retVal
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetPoiIMStatusReq struct {
|
type SetPoiIMStatusReq struct {
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ 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, hint := im.GetPoiIMStatus(req)
|
retVal := im.GetPoiIMStatus(req)
|
||||||
return retVal, hint, nil
|
return retVal, "", nil
|
||||||
} else {
|
} else {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user