- C#小程序直播商品添加并提审goodsInfo must not be empty?
C#代码: return await Senparc.Weixin.MP.ApiHandlerWapper.TryCommonApiAsync(async accessToken => { var urlFormat = string.Format("https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token={0}", accessToken.AsUrlData()); var result = await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync(null, urlFormat, data, CommonJsonSendType.POST, timeOut: timeOut); return result; }, accessTokenOrAppId); 使用微信组件中的接口await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync提交数据报错 返回错误提示: 微信 POST 请求发生错误!错误代码:200002,说明:goodsInfo must not be empty rid: 5f35f1cb-7b7421a2-7b5d885a Senparc.Weixin.Exceptions.ErrorJsonResultException: 微信 POST 请求发生错误!错误代码:200002,说明:goodsInfo must not be empty rid: 5f35f1cb-7b7421a2-7b5d885a 在 Senparc.Weixin.CommonAPIs.CommonJsonSend.<>c.<.cctor>b__6_1(String apiUrl, String returnText) 在 Senparc.CO2NET.HttpUtility.Post.d__5`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- 原因: Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync提交表单数据时默认Header中的ContentType是text/xml 解决方案: 需要自己另外封装接口设置 request.ContentType =“application/json; charset=UTF-8”
2020-08-14 - C#新增临时素材(图片) media data missing hint?
c#代码 var accessTokenOrAppId = await AuthorizerContainer.TryGetAuthorizerAccessTokenAsync(strComponentAppID, strAuthorizerAppID); var result = await Senparc.Weixin.MP.AdvancedAPIs.MediaApi.UploadTemporaryMediaAsync(accessTokenOrAppId, UploadMediaFileType.image, strFilePath); if (result.errcode != ReturnCode.请求成功) throw new UserFriendlyException(result.errmsg); return result; strFilePath=@"D:\Image\202008\1747248019.jpg" [图片] 返回错误日志: media data missing hint: [w1nara0887d174] rid: 5f33a046-2cb32906-726c25c1
2020-08-13 - C#建直播间parameter startTime or endTime is invalid?
C#.net代码如下: return await Senparc.Weixin.MP.ApiHandlerWapper.TryCommonApiAsync(async accessToken => { var urlFormat = string.Format("https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token={0}", accessToken.AsUrlData()); var result = await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync(null, urlFormat, data, CommonJsonSendType.POST, timeOut: timeOut); return result; }, accessTokenOrAppId); 这个创建直播间接口,不能用微信组件post过去吗??? 当前时间是2020-08-13 13:03:00 直播开始时间 2020-08-13 15:00:00 直播结束时间 2020-08-13 16:00:00 调试情况(图片不清晰请放大看): [图片] 错误日志如下: 微信 POST 请求发生错误!错误代码:200002,说明:parameter startTime or endTime is invalid rid: 5f34c975-207cd6f4-0a61eec7 Senparc.Weixin.Exceptions.ErrorJsonResultException: 微信 POST 请求发生错误!错误代码:200002,说明:parameter startTime or endTime is invalid rid: 5f34c975-207cd6f4-0a61eec7 在 Senparc.Weixin.CommonAPIs.CommonJsonSend.<>c.<.cctor>b__6_1(String apiUrl, String returnText) 在 Senparc.CO2NET.HttpUtility.Post.d__5`1.MoveNext() --- End of stack trace from previous location where exception was thrown ---
2020-08-13