123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Web;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Library;
- using MySystem.Models;
- namespace MySystem.Areas.Api.Controllers
- {
- public class BaseController : Controller
- {
- public IHttpContextAccessor _accessor;
- public BaseController(IHttpContextAccessor accessor)
- {
- _accessor = accessor;
- }
- public Models.Main.WebCMSEntities maindb = new Models.Main.WebCMSEntities();
- public Models.Main1.WebCMSEntities main1db = new Models.Main1.WebCMSEntities();
- public Models.KxsMainModels.WebCMSEntities kxsdb = new Models.KxsMainModels.WebCMSEntities();
- public static string ApiKey = "G6H7@J8%";
- public static string Host = Library.ConfigurationManager.AppSettings["Host"].ToString();
- public static string SourceHost = Library.ConfigurationManager.AppSettings["SourceHost"].ToString();
- public static string SpHost = Library.ConfigurationManager.AppSettings["SpHost"].ToString();
- public static string OssHost = Library.ConfigurationManager.AppSettings["OssHost"].ToString();
- public string OssKey = Library.ConfigurationManager.AppSettings["OSSKey"].ToString();
- public string OssSecret = Library.ConfigurationManager.AppSettings["OSSSecret"].ToString();
- public string OssEndpoint = Library.ConfigurationManager.AppSettings["OSSEndpoint"].ToString();
- public static string Database = Library.ConfigurationManager.AppSettings["Database"].ToString();
- public static string defaultImage = Library.ConfigurationManager.AppSettings["Host"].ToString() + "/skin/app/default/static/images/header.png";
- //jwt参数
- public string JwtSecret = Library.ConfigurationManager.AppSettings["JwtSecret"].ToString();
- public string JwtIss = Library.ConfigurationManager.AppSettings["JwtIss"].ToString();
- public string JwtAud = Library.ConfigurationManager.AppSettings["JwtAud"].ToString();
- #region 接口通用DES解密
- public string DesDecrypt(string content)
- {
- content = HttpUtility.UrlDecode(content);
- return dbconn.DesDecrypt(content, "*ga34|^7");
- }
- #endregion
- #region 默认图片
- public static string DefaultPic(string picpath)
- {
- if (!string.IsNullOrEmpty(picpath))
- {
- if (picpath.StartsWith("http"))
- {
- return picpath;
- }
- if (picpath.Contains("/v2/") || picpath.Contains("/upload/"))
- {
- return OssHost + picpath;
- }
- return SourceHost + picpath;
- }
- return OssHost + "/default.png";
- }
- #endregion
- }
- }
|