This commit is contained in:
yangsiqi1376@163.com
2023-11-02 15:17:42 +08:00
parent 74db198aed
commit 75c6cf88bf
2 changed files with 16 additions and 22 deletions

View File

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

View File

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