Example #1
0
 public JsonResult ThirdPartyList()
 {
     try
     {
         var result = new List <ThirdPartyModel>();
         if (SettingManager.GetSettingValue <bool>(AppSettingNames.OAuth.QQ.IsEnabled))
         {
             result.Add(new ThirdPartyModel
             {
                 ThirdParty     = ThirdParty.QQ.ToString(),
                 ThirdPartyName = "QQ",
                 AuthUrl        = _qqAuthService.GetAuthRedirectUrl(),
                 IconUrl        = "/Images/qq.png"
             });
         }
         if (SettingManager.GetSettingValue <bool>(AppSettingNames.OAuth.WeixinOpen.IsEnabled))
         {
             result.Add(new ThirdPartyModel
             {
                 ThirdParty     = ThirdParty.Weixin.ToString(),
                 ThirdPartyName = "微信",
                 AuthUrl        = _weixinAuthService.GetAuthRedirectUrl(),
                 IconUrl        = "/Images/wechat.png"
             });
         }
         if (SettingManager.GetSettingValue <bool>(AppSettingNames.OAuth.Weibo.IsEnabled))
         {
             result.Add(new ThirdPartyModel
             {
                 ThirdParty     = ThirdParty.Weibo.ToString(),
                 ThirdPartyName = "微博",
                 AuthUrl        = _weiboAuthService.GetAuthRedirectUrl(),
                 IconUrl        = "/Images/weibo.png"
             });
         }
         if (SettingManager.GetSettingValue <bool>(AppSettingNames.OAuth.Alipay.IsEnabled))
         {
             result.Add(new ThirdPartyModel
             {
                 ThirdParty     = ThirdParty.Alipay.ToString(),
                 ThirdPartyName = "支付宝",
                 AuthUrl        = _alipayAuthService.GetAuthRedirectUrl(),
                 IconUrl        = "/Images/alipay.png"
             });
         }
         return(Json(new AjaxResponse(result)));
     }
     catch (Exception ex)
     {
         LogHelper.LogException(Logger, ex);
         Response.StatusCode = (int)HttpStatusCode.InternalServerError;
         EventBus.Trigger(this, new AbpHandledExceptionData(ex));
         return(Json(new AjaxResponse(ErrorInfoBuilder.BuildForException(ex))));
     }
 }