public string UploadImage(string filePath) { UploadImageResultJson uploadImageResultJson = PoiApi.UploadImage(_accessToken, filePath, 10000); if (uploadImageResultJson.errcode != ReturnCode.请求成功) { throw new Exception(uploadImageResultJson.errmsg); } return(uploadImageResultJson.url); }
public string UploadImage(string filePath) { var result = PoiApi.UploadImage(this._accessToken, filePath); if (result.errcode != 0) { throw new Exception(result.errmsg); } return(result.url); }
public void UploadImageTest() { var accessToken = AccessTokenContainer.GetAccessToken(_appId); string file = @"E:\1.jpg"; var result = PoiApi.UploadImage(accessToken, file); Assert.IsNotNull(result); Assert.AreEqual(result.errcode, ReturnCode.请求成功); }
public static IEnumerable <string> ImageUploadForStore(IEnumerable <string> files) { IList <string> list = new List <string>(); foreach (string file2 in files) { string file = $"{HttpContext.Current.Server.MapPath(file2)}"; Senparc.Weixin.MP.AdvancedAPIs.Poi.UploadImageResultJson uploadImageResultJson = PoiApi.UploadImage(WXStoreHelper.siteSettings.WeixinAppId, file, 10000); list.Add(uploadImageResultJson.url); } return(list); }