//taobao.item.propimg.upload 添加或修改属性图片 private PropImg UploadItemPropimgInternal(long numId, string properties, FileItem fItem) { _log.LogInfo(Resource.Log_PublishSaleImging, numId); var req = new ItemPropimgUploadRequest { NumIid = numId, Image = fItem, Properties = properties }; var tContext = InstanceLocator.Current.GetInstance <AuthorizedContext>(); ItemPropimgUploadResponse response = _client.Execute(req, tContext.SessionKey); if (response.IsError) { var ex = new TopResponseException(response.ErrCode, response.ErrMsg, response.SubErrCode, response.SubErrMsg, response.TopForbiddenFields); _log.LogError(Resource.Log_PublishSaleImgFailure, ex); throw ex; } _log.LogInfo(Resource.Log_PublishSaleImgSuccess, response.PropImg.Id, response.PropImg.Url); return(response.PropImg); }
/// <summary> /// 更新和添加销售商品图片 /// </summary> /// <param name="numId">商品编号</param> /// <param name="properties">销售属性</param> /// <param name="imgPath">本地图片路径</param> /// <returns></returns> public PropImg UploadItemPropimg(long numId, string properties,string imgPath) { #region validation if (numId <= 0 || string.IsNullOrEmpty(properties) || string.IsNullOrEmpty(imgPath)) throw new Exception(string.Format(Resource.ExceptionTemplate_MethedParameterIsNullorEmpty, new System.Diagnostics.StackTrace().ToString())); #endregion ItemPropimgUploadRequest req = new ItemPropimgUploadRequest(); req.NumIid = numId; FileItem fItem = new FileItem(imgPath); req.Image = fItem; req.Properties = properties; TopContext tContext = InstanceLocator.Current.GetInstance<TopContext>(); ItemPropimgUploadResponse response = client.Execute(req, tContext.SessionKey); if (response.IsError) throw new TopResponseException(response.ErrCode, response.ErrMsg, response.SubErrCode, response.SubErrMsg, response.TopForbiddenFields); return response.PropImg; }
public static PropImg UploadItemPropImg(long numiid, string sku, string imgPath) { ITopClient client = TopClientService.GetTopClient(); ItemPropimgUploadRequest req = new ItemPropimgUploadRequest(); req.NumIid = numiid; req.Properties = sku; FileItem fItem = new FileItem(imgPath); req.Image = fItem; ItemPropimgUploadResponse response = client.Execute(req, SessionKey); return response.PropImg; }
//taobao.item.propimg.upload 添加或修改属性图片 private PropImg UploadItemPropimgInternal(long numId, string properties, FileItem fItem) { _log.LogInfo(Resource.Log_PublishSaleImging, numId); var req = new ItemPropimgUploadRequest {NumIid = numId, Image = fItem, Properties = properties}; var tContext = InstanceLocator.Current.GetInstance<AuthorizedContext>(); ItemPropimgUploadResponse response = _client.Execute(req, tContext.SessionKey); if (response.IsError) { var ex = new TopResponseException(response.ErrCode, response.ErrMsg, response.SubErrCode, response.SubErrMsg, response.TopForbiddenFields); _log.LogError(Resource.Log_PublishSaleImgFailure, ex); throw ex; } _log.LogInfo(Resource.Log_PublishSaleImgSuccess, response.PropImg.Id, response.PropImg.Url); return response.PropImg; }