public void DeviceListTest() { var accessToken = AccessTokenContainer.GetAccessToken(_appId); var result = ShakeAroundApi.DeviceList(accessToken, 1438704000, "1"); Assert.AreEqual(ReturnCode.请求成功, result.errcode); Assert.IsNotNull(result.devices); Assert.AreEqual("10097", result.devices[0].device_id); }
public void DeviceApplyTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = ShakeAroundApi.DeviceApply(accessToken, 1, "测试", "测试"); Assert.IsNotNull(result); Assert.AreEqual(result.errcode, ReturnCode.请求成功); }
public void GetPagesTest() { var accessToken = AccessTokenContainer.GetToken(_appId); var result = ShakeAroundApi.SearchPagesByRange(accessToken, 0, 49); Assert.IsNotNull(result); Assert.AreEqual(result.errcode, ReturnCode.请求成功); }
public DeviceListResultJson UnauthorizedTest() { var result = ShakeAroundApi.SearchDeviceByRange(this._accessToken, 0, 1); if (result.errcode != 0 && result.errcode != Senparc.Weixin.ReturnCode.api功能未授权 && ( int )result.errcode != 9001020) { throw new HimallException(result.errmsg); } return(result); }
public List <DeviceModel> GetDeviceAll() { var result = ShakeAroundApi.SearchDeviceByRange(this._accessToken, 0, 49); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(result.data.devices); }
public bool UpdateDevice(long deviceId, string uuId, long major, long minor, string comment, long poiId = 0) { var result = ShakeAroundApi.DeviceUpdate(this._accessToken, deviceId, uuId, major, minor, comment, poiId); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(true); }
public bool AddDevice(int quantity, string applyReason, string comment = null, long?poiId = null) { var result = ShakeAroundApi.DeviceApply(this._accessToken, quantity, applyReason, comment, poiId); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(true); }
public bool SetRelationship(DeviceApply_Data_Device_Identifiers deviceIdentifier, long[] pageIds, ShakeAroundBindType type) { var result = ShakeAroundApi.BindPage(this._accessToken, deviceIdentifier, pageIds, type, ShakeAroundAppendType.新增); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(true); }
public List <SearchPages_Data_Page> GetPageById(long[] ids) { var result = ShakeAroundApi.SearchPagesByPageId(this._accessToken, ids); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(result.data.pages); }
public SearchPages_Data GetPageAll() { var result = ShakeAroundApi.SearchPagesByRange(this._accessToken, 0, 49); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(result.data); }
public bool UpdatePage(long pageId, string title, string description, string pageUrl, string iconUrl, string comment = null) { var result = ShakeAroundApi.UpdatePage(this._accessToken, pageId, title, description, pageUrl, iconUrl, comment); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(true); }
public List <SearchPages_Data_Page> GetPageById(long[] ids) { SearchPagesResultJson searchPagesResultJson = ShakeAroundApi.SearchPagesByPageId(_accessToken, ids, 10000); if (searchPagesResultJson.errcode != ReturnCode.请求成功) { throw new Exception(searchPagesResultJson.errmsg); } return(searchPagesResultJson.data.pages); }
public bool DeviceBindLocatoin(long deviceId, string uuId, long major, long minor, long poiId) { var result = ShakeAroundApi.DeviceBindLocatoin(this._accessToken, deviceId, uuId, major, minor, poiId); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(true); }
public string UploadImage(string file) { UploadImageResultJson uploadImageResultJson = ShakeAroundApi.UploadImage(_accessToken, file, 10000); if (uploadImageResultJson.errcode != ReturnCode.请求成功) { throw new Exception(uploadImageResultJson.errmsg); } return(uploadImageResultJson.data.pic_url); }
public bool AddPage(string title, string description, string pageUrl, string iconUrl, string comment = null) { AddPageResultJson addPageResultJson = ShakeAroundApi.AddPage(_accessToken, title, description, pageUrl, iconUrl, comment, 10000); if (addPageResultJson.errcode != ReturnCode.请求成功) { throw new Exception(addPageResultJson.errmsg); } return(true); }
public bool UpdatePage(long pageId, string title, string description, string pageUrl, string iconUrl, string comment = null) { UpdatePageResultJson updatePageResultJson = ShakeAroundApi.UpdatePage(_accessToken, pageId, title, description, pageUrl, iconUrl, comment, 10000); if (updatePageResultJson.errcode != ReturnCode.请求成功) { throw new Exception(updatePageResultJson.errmsg); } return(true); }
public SearchPages_Data GetPageAll() { SearchPagesResultJson searchPagesResultJson = ShakeAroundApi.SearchPagesByRange(_accessToken, 0, 49, 10000); if (searchPagesResultJson.errcode != ReturnCode.请求成功) { throw new Exception(searchPagesResultJson.errmsg); } return(searchPagesResultJson.data); }
public DeviceListResultJson UnauthorizedTest() { DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceByRange(_accessToken, 0, 1, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功 && deviceListResultJson.errcode != ReturnCode.api功能未授权) { throw new Exception(deviceListResultJson.errmsg); } return(deviceListResultJson); }
public bool UpdateDevice(long deviceId, string uuId, long major, long minor, string comment, long poiId = 0L) { WxJsonResult wxJsonResult = ShakeAroundApi.DeviceUpdate(_accessToken, deviceId, uuId, major, minor, comment, poiId, 10000); if (wxJsonResult.errcode != ReturnCode.请求成功) { throw new Exception(wxJsonResult.errmsg); } return(true); }
public bool SetRelationship(DeviceApply_Data_Device_Identifiers deviceIdentifier, long[] pageIds, ShakeAroundBindType type) { WxJsonResult wxJsonResult = ShakeAroundApi.BindPage(_accessToken, deviceIdentifier, pageIds, type, ShakeAroundAppendType.新增, 10000); if (wxJsonResult.errcode != ReturnCode.请求成功) { throw new Exception(wxJsonResult.errmsg); } return(true); }
public List <DeviceModel> GetDeviceAll() { DeviceListResultJson deviceListResultJson = ShakeAroundApi.SearchDeviceByRange(_accessToken, 0, 49, 10000); if (deviceListResultJson.errcode != ReturnCode.请求成功) { throw new Exception(deviceListResultJson.errmsg); } return(deviceListResultJson.data.devices); }
public string UploadImage(string file) { var result = ShakeAroundApi.UploadImage(this._accessToken, file); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(result.data.pic_url); }
public bool DeviceBindLocatoin(long deviceId, string uuId, long major, long minor, long poiId) { WxJsonResult wxJsonResult = ShakeAroundApi.DeviceBindLocatoin(_accessToken, deviceId, uuId, major, minor, poiId, 10000); if (wxJsonResult.errcode != ReturnCode.请求成功) { throw new Exception(wxJsonResult.errmsg); } return(true); }
public bool AddDevice(int quantity, string applyReason, string comment = null, long?poiId = null) { DeviceApplyResultJson deviceApplyResultJson = ShakeAroundApi.DeviceApply(_accessToken, quantity, applyReason, comment, poiId, 10000); if (deviceApplyResultJson.errcode != ReturnCode.请求成功) { throw new Exception(deviceApplyResultJson.errmsg); } return(true); }
public void UploadImageTest() { var accessToken = AccessTokenContainer.GetToken(_appId); string file = @"E:\测试.jpg"; var result = ShakeAroundApi.UploadImage(accessToken, file); Assert.IsNotNull(result); Assert.AreEqual(result.errcode, ReturnCode.请求成功); }
public List <long> GetPageids(DeviceModel model) { DeviceApply_Data_Device_Identifiers d = new DeviceApply_Data_Device_Identifiers(); d.device_id = long.Parse(model.device_id); d.major = long.Parse(model.major); d.minor = long.Parse(model.minor); d.uuid = model.uuid; var result = ShakeAroundApi.SearchPagesByDeviceId(this._accessToken, 1, d); return(result.data.relations.Select(p => p.page_id).ToList()); }
public bool DeletePage(List <long> ids) { var result = ShakeAroundApi.DeletePage(this._accessToken, ids.ToArray()); if (result.errcode != 0) { if (result.errmsg.Equals("the page has been binded to device ID")) { throw new HimallException("页面已配置到设备"); } throw new Exception(result.errmsg); } return(true); }
public bool DeletePage(List <long> ids) { WxJsonResult wxJsonResult = ShakeAroundApi.DeletePage(_accessToken, ids.ToArray(), 10000); if (wxJsonResult.errcode != ReturnCode.请求成功) { if (!wxJsonResult.errmsg.Equals("the page has been binded to device ID")) { throw new Exception(wxJsonResult.errmsg); } throw new HimallException("页面已配置到设备"); } return(true); }
public void DeviceByIdTest() { var accessToken = AccessTokenContainer.GetToken(_appId); DeviceApply_Data_Device_Identifiers d = new DeviceApply_Data_Device_Identifiers(); d.device_id = 1015959; var result = ShakeAroundApi.SearchDeviceById(accessToken, new List <DeviceApply_Data_Device_Identifiers> { d }); Assert.IsNotNull(result); Assert.AreEqual(result.errcode, ReturnCode.请求成功); }
public List <long> GetPageids(DeviceModel model) { DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier = new DeviceApply_Data_Device_Identifiers() { device_id = long.Parse(model.device_id), major = long.Parse(model.major), minor = long.Parse(model.minor), uuid = model.uuid }; RelationResult relationResult = ShakeAroundApi.SearchPagesByDeviceId(_accessToken, 1, deviceApplyDataDeviceIdentifier, 10000); return(( from p in relationResult.data.relations select p.page_id).ToList()); }