public ApiResult <WeiXinShare> Share(WeiXinShareInput shareInput) { if (shareInput.Url.IsNullOrEmpty()) { return(ApiResult.Failure <WeiXinShare>("分享网址不能为空")); } //Resolve<IUserService>().Log("分享" + shareInput.ToJsons()); var webSite = Resolve <IAlaboAutoConfigService>().GetValue <WebSiteConfig>(); try { var result = Resolve <IWeixinMpService>().WeiXinShare(shareInput); return(ApiResult.Success(result)); } catch (Exception exception) { Resolve <ITableService>().Log("微信分享接口获取错误" + exception.Message); return(ApiResult.Failure <WeiXinShare>(exception.Message)); } }
public WeiXinShare WeiXinShare(WeiXinShareInput shareInput) { //var wexinConfig = Ioc.Resolve<IAutoConfigService>().GetValue<WeChatPaymentConfig>(); //var jsApiTicketResult = Ioc.Resolve<IWeixinMpClient>().GetTicketByAccessToken(); //if (jsApiTicketResult == null) { // Resolve<ITableService>().Log("tickets获取失败"); // throw new ValidException("tickets获取失败"); //} //var webSiteConfig = Resolve<IAutoConfigService>().GetValue<WebSiteConfig>(); //if (CollectionExtensions.IsNullOrEmpty(shareInput.Title)) { // shareInput.Title = webSiteConfig.WebSiteName; //} //if (CollectionExtensions.IsNullOrEmpty(shareInput.Description)) { // shareInput.Description = webSiteConfig.Description; //} //if (CollectionExtensions.IsNullOrEmpty(shareInput.ImageUrl)) { // shareInput.ImageUrl = Resolve<IApiService>().ApiImageUrl(webSiteConfig.Logo); //} //WeiXinShare share = new WeiXinShare { // AppId = wexinConfig.AppId, // Timestamp = JSSDKHelper.GetTimestamp(), // Link = shareInput.Url, // Ticket = jsApiTicketResult.ticket, // ImageUrl = shareInput.ImageUrl, // Title = shareInput.Title, // Description = shareInput.Description, // NonceStr = JSSDKHelper.GetNoncestr() //}; //share.Signature = JSSDKHelper.GetSignature(jsApiTicketResult.ticket, share.NonceStr, share.Timestamp, // share.Link); //Resolve<ITableService>().Log("微信分享" + share.ToJson()); //return share; return(null); }