Commit 6cc95445 authored by 黄奎's avatar 黄奎

页面修改

parent 25a131f7
...@@ -75,7 +75,7 @@ namespace Edu.CacheManager.Base ...@@ -75,7 +75,7 @@ namespace Edu.CacheManager.Base
/// <returns></returns> /// <returns></returns>
private static ConnectionMultiplexer GetManager(string connectionString = null) private static ConnectionMultiplexer GetManager(string connectionString = null)
{ {
connectionString = connectionString ?? RedisConnectionString; connectionString ??= RedisConnectionString;
var connect = ConnectionMultiplexer.Connect(connectionString); var connect = ConnectionMultiplexer.Connect(connectionString);
//注册如下事件 //注册如下事件
......
...@@ -3,7 +3,6 @@ using StackExchange.Redis; ...@@ -3,7 +3,6 @@ using StackExchange.Redis;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Edu.CacheManager.Base namespace Edu.CacheManager.Base
...@@ -80,7 +79,7 @@ namespace Edu.CacheManager.Base ...@@ -80,7 +79,7 @@ namespace Edu.CacheManager.Base
/// <param name="value">保存的值</param> /// <param name="value">保存的值</param>
/// <param name="expiry">过期时间</param> /// <param name="expiry">过期时间</param>
/// <returns></returns> /// <returns></returns>
public bool StringSet(string key, string value, TimeSpan? expiry = default(TimeSpan?)) public bool StringSet(string key, string value, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
return Do(db => db.StringSet(key, value, expiry)); return Do(db => db.StringSet(key, value, expiry));
...@@ -106,7 +105,7 @@ namespace Edu.CacheManager.Base ...@@ -106,7 +105,7 @@ namespace Edu.CacheManager.Base
/// <param name="obj"></param> /// <param name="obj"></param>
/// <param name="expiry"></param> /// <param name="expiry"></param>
/// <returns></returns> /// <returns></returns>
public bool StringSet<T>(string key, T obj, TimeSpan? expiry = default(TimeSpan?)) public bool StringSet<T>(string key, T obj, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
string json = ConvertJson(obj); string json = ConvertJson(obj);
...@@ -182,7 +181,7 @@ namespace Edu.CacheManager.Base ...@@ -182,7 +181,7 @@ namespace Edu.CacheManager.Base
/// <param name="value">保存的值</param> /// <param name="value">保存的值</param>
/// <param name="expiry">过期时间</param> /// <param name="expiry">过期时间</param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> StringSetAsync(string key, string value, TimeSpan? expiry = default(TimeSpan?)) public async Task<bool> StringSetAsync(string key, string value, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
return await Do(db => db.StringSetAsync(key, value, expiry)); return await Do(db => db.StringSetAsync(key, value, expiry));
...@@ -208,7 +207,7 @@ namespace Edu.CacheManager.Base ...@@ -208,7 +207,7 @@ namespace Edu.CacheManager.Base
/// <param name="obj"></param> /// <param name="obj"></param>
/// <param name="expiry"></param> /// <param name="expiry"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> StringSetAsync<T>(string key, T obj, TimeSpan? expiry = default(TimeSpan?)) public async Task<bool> StringSetAsync<T>(string key, T obj, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
string json = ConvertJson(obj); string json = ConvertJson(obj);
...@@ -859,7 +858,7 @@ namespace Edu.CacheManager.Base ...@@ -859,7 +858,7 @@ namespace Edu.CacheManager.Base
/// <param name="key">redis key</param> /// <param name="key">redis key</param>
/// <param name="expiry"></param> /// <param name="expiry"></param>
/// <returns></returns> /// <returns></returns>
public bool KeyExpire(string key, TimeSpan? expiry = default(TimeSpan?)) public bool KeyExpire(string key, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
return Do(db => db.KeyExpire(key, expiry)); return Do(db => db.KeyExpire(key, expiry));
...@@ -918,7 +917,7 @@ namespace Edu.CacheManager.Base ...@@ -918,7 +917,7 @@ namespace Edu.CacheManager.Base
/// <param name="key">redis key</param> /// <param name="key">redis key</param>
/// <param name="expiry"></param> /// <param name="expiry"></param>
/// <returns></returns> /// <returns></returns>
public async Task<bool> KeyExpireAsync(string key, TimeSpan? expiry = default(TimeSpan?)) public async Task<bool> KeyExpireAsync(string key, TimeSpan? expiry = default)
{ {
key = AddSysCustomKey(key); key = AddSysCustomKey(key);
return await Do(db => db.KeyExpireAsync(key, expiry)); return await Do(db => db.KeyExpireAsync(key, expiry));
...@@ -1108,7 +1107,7 @@ namespace Edu.CacheManager.Base ...@@ -1108,7 +1107,7 @@ namespace Edu.CacheManager.Base
private T ConvertObj<T>(RedisValue value) private T ConvertObj<T>(RedisValue value)
{ {
if (value.IsNullOrEmpty) if (value.IsNullOrEmpty)
return default(T); return default;
return JsonConvert.DeserializeObject<T>(value); return JsonConvert.DeserializeObject<T>(value);
} }
......
...@@ -81,7 +81,7 @@ namespace Edu.Cache.User ...@@ -81,7 +81,7 @@ namespace Edu.Cache.User
/// <summary> /// <summary>
/// 账号仓储层对象 /// 账号仓储层对象
/// </summary> /// </summary>
private static RB_AccountRepository accountRepository = new RB_AccountRepository(); private static readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary> /// <summary>
/// 获取用户登录信息 /// 获取用户登录信息
......
using Edu.Common.Enum; namespace Edu.Common.API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.API
{ {
/// <summary> /// <summary>
/// API请求参数 /// API请求参数
......
using System; namespace Edu.Common.API
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.API
{ {
/// <summary> /// <summary>
/// Api返回结果枚举 /// Api返回结果枚举
......
 namespace Edu.Common.Enum
namespace Edu.Common.Enum
{ {
/// <summary> /// <summary>
/// 缓存时间(秒) /// 缓存时间(秒)
......
using Edu.Common.Plugin; using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.User namespace Edu.Common.Enum.User
{ {
......
using Edu.Common.Plugin; using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.User namespace Edu.Common.Enum.User
{ {
......
...@@ -201,7 +201,7 @@ namespace Edu.Common.Plugin ...@@ -201,7 +201,7 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static T Clone<T>(T obj) public static T Clone<T>(T obj)
{ {
T ret = default(T); T ret = default;
if (obj != null) if (obj != null)
{ {
XmlSerializer cloner = new XmlSerializer(typeof(T)); XmlSerializer cloner = new XmlSerializer(typeof(T));
......
...@@ -56,7 +56,7 @@ namespace Edu.Common ...@@ -56,7 +56,7 @@ namespace Edu.Common
/// <returns></returns> /// <returns></returns>
public static T ConvertTo<T>(object obj) public static T ConvertTo<T>(object obj)
{ {
if (obj == null) return default(T);//返回默认值 if (obj == null) return default;//返回默认值
Type tp = typeof(T); Type tp = typeof(T);
//泛型Nullable判断,取其中的类型 //泛型Nullable判断,取其中的类型
if (tp.IsGenericType) if (tp.IsGenericType)
...@@ -81,11 +81,11 @@ namespace Edu.Common ...@@ -81,11 +81,11 @@ namespace Edu.Common
{ {
return (T)parameters[1]; return (T)parameters[1];
} }
return default(T); return default;
} }
catch catch
{ {
return default(T); return default;
} }
} }
......
...@@ -67,8 +67,6 @@ namespace Edu.Common.Plugin ...@@ -67,8 +67,6 @@ namespace Edu.Common.Plugin
} }
//获取字段信息 //获取字段信息
System.Reflection.FieldInfo[] ms = e.GetType().GetFields(); System.Reflection.FieldInfo[] ms = e.GetType().GetFields();
Type t = e.GetType();
foreach (System.Reflection.FieldInfo f in ms) foreach (System.Reflection.FieldInfo f in ms)
{ {
//判断名称是否相等 //判断名称是否相等
...@@ -136,7 +134,7 @@ namespace Edu.Common.Plugin ...@@ -136,7 +134,7 @@ namespace Edu.Common.Plugin
{ {
if (string.IsNullOrEmpty(obj)) if (string.IsNullOrEmpty(obj))
{ {
return default(T); return default;
} }
try try
{ {
...@@ -144,7 +142,7 @@ namespace Edu.Common.Plugin ...@@ -144,7 +142,7 @@ namespace Edu.Common.Plugin
} }
catch (Exception) catch (Exception)
{ {
return default(T); return default;
} }
} }
} }
......
...@@ -74,9 +74,8 @@ namespace Edu.Common.Plugin ...@@ -74,9 +74,8 @@ namespace Edu.Common.Plugin
FileSystemInfo[] files = theFolder.GetFileSystemInfos(); FileSystemInfo[] files = theFolder.GetFileSystemInfos();
for (int i = 0; i < files.Length; i++) for (int i = 0; i < files.Length; i++)
{ {
FileInfo file = files[i] as FileInfo;
//是文件 //是文件
if (file != null) if (files[i] is FileInfo file)
{ {
file.Delete(); file.Delete();
} }
...@@ -112,9 +111,8 @@ namespace Edu.Common.Plugin ...@@ -112,9 +111,8 @@ namespace Edu.Common.Plugin
FileSystemInfo[] files = theFolder.GetFileSystemInfos(); FileSystemInfo[] files = theFolder.GetFileSystemInfos();
for (int i = 0; i < files.Length; i++) for (int i = 0; i < files.Length; i++)
{ {
FileInfo file = files[i] as FileInfo;
//是文件 //是文件
if (file != null) if (files[i] is FileInfo file)
{ {
fileList.Add(Config.ViewFileSiteUrl + "/Feature/" + TCID + "/" + file.Name); fileList.Add(Config.ViewFileSiteUrl + "/Feature/" + TCID + "/" + file.Name);
} }
......
...@@ -41,7 +41,6 @@ namespace Edu.Common.Plugin ...@@ -41,7 +41,6 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
private static bool IsInnerIP(String ipAddress) private static bool IsInnerIP(String ipAddress)
{ {
bool isInnerIp = false;
long ipNum = GetIpNum(ipAddress); long ipNum = GetIpNum(ipAddress);
/***** ***** ***** ***** ***** ***** /***** ***** ***** ***** ***** *****
私有IP: 私有IP:
...@@ -56,7 +55,7 @@ namespace Edu.Common.Plugin ...@@ -56,7 +55,7 @@ namespace Edu.Common.Plugin
long bEnd = GetIpNum("172.31.255.255"); long bEnd = GetIpNum("172.31.255.255");
long cBegin = GetIpNum("192.168.0.0"); long cBegin = GetIpNum("192.168.0.0");
long cEnd = GetIpNum("192.168.255.255"); long cEnd = GetIpNum("192.168.255.255");
isInnerIp = IsInner(ipNum, aBegin, aEnd) || IsInner(ipNum, bBegin, bEnd) || IsInner(ipNum, cBegin, cEnd) || ipAddress.Equals("127.0.0.1"); bool isInnerIp = IsInner(ipNum, aBegin, aEnd) || IsInner(ipNum, bBegin, bEnd) || IsInner(ipNum, cBegin, cEnd) || ipAddress.Equals("127.0.0.1");
return isInnerIp; return isInnerIp;
} }
......
...@@ -10,12 +10,12 @@ namespace Edu.Common.Plugin ...@@ -10,12 +10,12 @@ namespace Edu.Common.Plugin
/// </summary> /// </summary>
public class LogHelper public class LogHelper
{ {
private static string logDir = Config.LogPath; private static readonly string logDir = Config.LogPath;
private static string infoLogDir = Config.InofLogPath; private static readonly string infoLogDir = Config.InofLogPath;
private static string requestLogDir = Config.RequestLogPath; private static readonly string requestLogDir = Config.RequestLogPath;
private static object objError = new object(); private static readonly object objError = new object();
private static object objInfo = new object(); private static readonly object objInfo = new object();
private static object objRequest = new object(); private static readonly object objRequest = new object();
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
......
using NPOI.HPSF; using NPOI.HSSF.UserModel;
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Util;
using NPOI.SS.Formula.Eval; using NPOI.SS.Formula.Eval;
using NPOI.SS.UserModel; using NPOI.SS.UserModel;
using NPOI.SS.Util; using NPOI.SS.Util;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using NPOI.XWPF.UserModel;
using System; using System;
using System.Collections;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
namespace Edu.Common.Plugin namespace Edu.Common.Plugin
{ {
......
...@@ -83,13 +83,15 @@ namespace Edu.Common.Plugin ...@@ -83,13 +83,15 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static uint WNetAddConnection(string username, string password, string remoteName, string localName) public static uint WNetAddConnection(string username, string password, string remoteName, string localName)
{ {
NetResource netResource = new NetResource(); NetResource netResource = new NetResource
netResource.dwScope = 2; {
netResource.dwType = 1; dwScope = 2,
netResource.dwDisplayType = 3; dwType = 1,
netResource.dwUsage = 1; dwDisplayType = 3,
netResource.lpLocalName = localName; dwUsage = 1,
netResource.lpRemoteName = remoteName.TrimEnd('\\'); lpLocalName = localName,
lpRemoteName = remoteName.TrimEnd('\\')
};
uint result = WNetAddConnection2(netResource, password, username, 0); uint result = WNetAddConnection2(netResource, password, username, 0);
return result; return result;
} }
......
...@@ -14,12 +14,11 @@ namespace Edu.Common.Plugin ...@@ -14,12 +14,11 @@ namespace Edu.Common.Plugin
public class RSAHelper public class RSAHelper
{ {
//Erp公钥 //Erp公钥
static string TargetPublicKey = @"<RSAKeyValue><Modulus>qr3Hipzvvn9dsFn1juGEM5vHiYl4whHnJ7DFqC4ZVAotL0bRCZd7vWvPl53AJY9p8u2hNgPP3J6/I5NairyCiizW++8kCPue1Lpq9qc9ueBwij1bo5Sqi1nswpJsKyd9kOD5aOzqrnuhKTLYMZN9fkHl3L4wjpuVz1xlTgpYdxc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; static readonly string TargetPublicKey = @"<RSAKeyValue><Modulus>qr3Hipzvvn9dsFn1juGEM5vHiYl4whHnJ7DFqC4ZVAotL0bRCZd7vWvPl53AJY9p8u2hNgPP3J6/I5NairyCiizW++8kCPue1Lpq9qc9ueBwij1bo5Sqi1nswpJsKyd9kOD5aOzqrnuhKTLYMZN9fkHl3L4wjpuVz1xlTgpYdxc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
//小程序私钥 //小程序私钥
//static string PublicKey = @"<RSAKeyValue><Modulus>4W8WliHbSkVE20kIze0KvCIOJgwG4PSRHHb6LNjc3smttrU952pGFi7g7dly1tj+oNUpCB5Ba5a1EUQI9vlfCXUYRICdiNneW6T78BFED5x8HZp8JUCMeatD8wFrKPVV4twaj2QtqGsTw60ZVmVFzHi/eNLVBYvfnzKCGCp0dG8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; //static string PublicKey = @"<RSAKeyValue><Modulus>4W8WliHbSkVE20kIze0KvCIOJgwG4PSRHHb6LNjc3smttrU952pGFi7g7dly1tj+oNUpCB5Ba5a1EUQI9vlfCXUYRICdiNneW6T78BFED5x8HZp8JUCMeatD8wFrKPVV4twaj2QtqGsTw60ZVmVFzHi/eNLVBYvfnzKCGCp0dG8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
static string PrivateKey = @"<RSAKeyValue><Modulus>4W8WliHbSkVE20kIze0KvCIOJgwG4PSRHHb6LNjc3smttrU952pGFi7g7dly1tj+oNUpCB5Ba5a1EUQI9vlfCXUYRICdiNneW6T78BFED5x8HZp8JUCMeatD8wFrKPVV4twaj2QtqGsTw60ZVmVFzHi/eNLVBYvfnzKCGCp0dG8=</Modulus><Exponent>AQAB</Exponent><P>97qvHs/ptDJiw+FGvqvNLOJX1TJPbed9sfNNEhAZe+x/XPQfnzu0IxEkIxH/BL29gVryWExH8b/ZcgQuXCpUsw==</P><Q>6PXZPVntcKdo4ZlbQAU/+VI47rAZGkNtW/w25UVGrVC31Zc3GSqCVlKZgccRe6/PLrjOUBKDRYiYd3Yj+azXVQ==</Q><DP>ciyzW3Md1jRGutrQHT7XUHF9Y8BNRW0kzGhDRCjxZeEpDjFhhaUhr+vNiPBZZdkBR2YgPbviiLQQRvFQYKAN6w==</DP><DQ>AgBSrG9AVe5qPT3nBcbFxOuK56oFnS8lGlwxUIjm0YhW+/O/mmy+D+XHwdCm+swI2Jrn0tJF5GwG+0e9iWCNvQ==</DQ><InverseQ>WsKgSM0RiMFpXGoyL8bqZi2q1MAB+iz4WXPcL/OmHKluo8wuK/Pk+zOKkyjMO91tKXhjLOd7xpVb1AIsk/fAeQ==</InverseQ><D>daiCNFd1WZ0vo/fJZZkLWke39LmgOXbL6fxa9F83X/wI82xC4+4+qENNWDZ+zo2w0AaRBNCtulaNKHbG6wgaRh15yuOHkr90oydquHHPUqCjFWnIEYx2NnX85HtyBTwowCeePajCTsEi6vMRgKlBCIFWxqc6z5To1lTgfqtKb8k=</D></RSAKeyValue>"; static readonly string PrivateKey = @"<RSAKeyValue><Modulus>4W8WliHbSkVE20kIze0KvCIOJgwG4PSRHHb6LNjc3smttrU952pGFi7g7dly1tj+oNUpCB5Ba5a1EUQI9vlfCXUYRICdiNneW6T78BFED5x8HZp8JUCMeatD8wFrKPVV4twaj2QtqGsTw60ZVmVFzHi/eNLVBYvfnzKCGCp0dG8=</Modulus><Exponent>AQAB</Exponent><P>97qvHs/ptDJiw+FGvqvNLOJX1TJPbed9sfNNEhAZe+x/XPQfnzu0IxEkIxH/BL29gVryWExH8b/ZcgQuXCpUsw==</P><Q>6PXZPVntcKdo4ZlbQAU/+VI47rAZGkNtW/w25UVGrVC31Zc3GSqCVlKZgccRe6/PLrjOUBKDRYiYd3Yj+azXVQ==</Q><DP>ciyzW3Md1jRGutrQHT7XUHF9Y8BNRW0kzGhDRCjxZeEpDjFhhaUhr+vNiPBZZdkBR2YgPbviiLQQRvFQYKAN6w==</DP><DQ>AgBSrG9AVe5qPT3nBcbFxOuK56oFnS8lGlwxUIjm0YhW+/O/mmy+D+XHwdCm+swI2Jrn0tJF5GwG+0e9iWCNvQ==</DQ><InverseQ>WsKgSM0RiMFpXGoyL8bqZi2q1MAB+iz4WXPcL/OmHKluo8wuK/Pk+zOKkyjMO91tKXhjLOd7xpVb1AIsk/fAeQ==</InverseQ><D>daiCNFd1WZ0vo/fJZZkLWke39LmgOXbL6fxa9F83X/wI82xC4+4+qENNWDZ+zo2w0AaRBNCtulaNKHbG6wgaRh15yuOHkr90oydquHHPUqCjFWnIEYx2NnX85HtyBTwowCeePajCTsEi6vMRgKlBCIFWxqc6z5To1lTgfqtKb8k=</D></RSAKeyValue>";
static RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024);
/// <summary> /// <summary>
/// 加密 /// 加密
/// </summary> /// </summary>
...@@ -27,9 +26,7 @@ namespace Edu.Common.Plugin ...@@ -27,9 +26,7 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static byte[] EncryptData(byte[] data) public static byte[] EncryptData(byte[] data)
{ {
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
//将公钥导入到RSA对象中,准备加密; //将公钥导入到RSA对象中,准备加密;
rsa.FromXmlString(TargetPublicKey); rsa.FromXmlString(TargetPublicKey);
...@@ -46,16 +43,11 @@ namespace Edu.Common.Plugin ...@@ -46,16 +43,11 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static byte[] DecryptData(byte[] data) public static byte[] DecryptData(byte[] data)
{ {
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024); RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024);
//将私钥导入RSA中,准备解密; //将私钥导入RSA中,准备解密;
rsa.FromXmlString(PrivateKey); rsa.FromXmlString(PrivateKey);
//对数据进行解密,并返回解密结果; //对数据进行解密,并返回解密结果;
return rsa.Decrypt(data, false); return rsa.Decrypt(data, false);
} }
} }
} }
...@@ -84,22 +84,12 @@ namespace Edu.Common.Plugin ...@@ -84,22 +84,12 @@ namespace Edu.Common.Plugin
/// 获取大写的MD5签名结果 /// 获取大写的MD5签名结果
/// </summary> /// </summary>
/// <param name="encypStr"></param> /// <param name="encypStr"></param>
/// <param name="charset">默认值:utf-8</param>
/// <returns></returns> /// <returns></returns>
public static string MD5EncryptWeChat(string encypStr, string charset = "") public static string MD5EncryptWeChat(string encypStr)
{ {
var m5 = new MD5CryptoServiceProvider(); var m5 = new MD5CryptoServiceProvider();
//创建md5对象
byte[] inputBye; byte[] inputBye;
//使用GB2312编码方式把字符串转化为字节数组.
//if (!string.IsNullOrWhiteSpace(charset))
//{
// inputBye = Encoding.GetEncoding(charset).GetBytes(encypStr);
//}
//else
//{
inputBye = Encoding.GetEncoding("utf-8").GetBytes(encypStr); inputBye = Encoding.GetEncoding("utf-8").GetBytes(encypStr);
// }
var outputBye = m5.ComputeHash(inputBye); var outputBye = m5.ComputeHash(inputBye);
var retStr = BitConverter.ToString(outputBye); var retStr = BitConverter.ToString(outputBye);
retStr = retStr.Replace("-", "").ToUpper(); retStr = retStr.Replace("-", "").ToUpper();
...@@ -119,21 +109,21 @@ namespace Edu.Common.Plugin ...@@ -119,21 +109,21 @@ namespace Edu.Common.Plugin
string keyString = desKeyStr.Substring(0, 8); string keyString = desKeyStr.Substring(0, 8);
byte[] btKey = Encoding.UTF8.GetBytes(keyString); byte[] btKey = Encoding.UTF8.GetBytes(keyString);
byte[] btIv = Encoding.UTF8.GetBytes("12345678"); byte[] btIv = Encoding.UTF8.GetBytes("12345678");
var des = new DESCryptoServiceProvider(); var des = new DESCryptoServiceProvider
des.Mode = CipherMode.CBC;//这里指定加密模式为CBC
des.Padding = PaddingMode.PKCS7;
des.Key = btKey;
des.IV = btIv;
using (var ms = new MemoryStream())
{ {
byte[] inData = Convert.FromBase64String(encryptedString); Mode = CipherMode.CBC,//这里指定加密模式为CBC
using (var cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write)) Padding = PaddingMode.PKCS7,
{ Key = btKey,
cs.Write(inData, 0, inData.Length); IV = btIv
cs.FlushFinalBlock(); };
} using var ms = new MemoryStream();
return Encoding.UTF8.GetString(ms.ToArray()); byte[] inData = Convert.FromBase64String(encryptedString);
using (var cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write))
{
cs.Write(inData, 0, inData.Length);
cs.FlushFinalBlock();
} }
return Encoding.UTF8.GetString(ms.ToArray());
} }
/// <summary> /// <summary>
...@@ -147,16 +137,14 @@ namespace Edu.Common.Plugin ...@@ -147,16 +137,14 @@ namespace Edu.Common.Plugin
byte[] btIv = Encoding.UTF8.GetBytes("12345678"); byte[] btIv = Encoding.UTF8.GetBytes("12345678");
byte[] btKey = Encoding.UTF8.GetBytes(keyString); byte[] btKey = Encoding.UTF8.GetBytes(keyString);
DESCryptoServiceProvider des = new DESCryptoServiceProvider(); DESCryptoServiceProvider des = new DESCryptoServiceProvider();
using (MemoryStream ms = new MemoryStream()) using MemoryStream ms = new MemoryStream();
byte[] inData = Encoding.UTF8.GetBytes(sourceString);
using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(btKey, btIv), CryptoStreamMode.Write))
{ {
byte[] inData = Encoding.UTF8.GetBytes(sourceString); cs.Write(inData, 0, inData.Length);
using (CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(btKey, btIv), CryptoStreamMode.Write)) cs.FlushFinalBlock();
{
cs.Write(inData, 0, inData.Length);
cs.FlushFinalBlock();
}
return Convert.ToBase64String(ms.ToArray());
} }
return Convert.ToBase64String(ms.ToArray());
} }
#endregion #endregion
} }
......
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Edu.Common.Plugin namespace Edu.Common.Plugin
{ {
......
...@@ -206,25 +206,6 @@ namespace Edu.Common.Plugin ...@@ -206,25 +206,6 @@ namespace Edu.Common.Plugin
return new DateTime(year, month, 1).AddMonths(1).AddDays(-1); return new DateTime(year, month, 1).AddMonths(1).AddDays(-1);
} }
/// <summary>
/// 是否为日期+时间型字符串
/// </summary>
/// <param name="StrSource"></param>
/// <returns></returns>
public static bool IsDateTime(object StrSource)
{
DateTime dt = DateTime.Now;
if (DateTime.TryParse(StrSource.ToString(), out dt))
{
return true;
}
else
{
return false;
}
}
/// <summary> /// <summary>
/// 时间 /// 时间
/// </summary> /// </summary>
...@@ -686,17 +667,6 @@ namespace Edu.Common.Plugin ...@@ -686,17 +667,6 @@ namespace Edu.Common.Plugin
return Encoding.Default.GetString(Byt); return Encoding.Default.GetString(Byt);
} }
/// <summary>
/// 截取指定长度HTML内容 (该方法未完成)
/// </summary>
/// <param name="html"></param>
/// <param name="len"></param>
/// <returns></returns>
public static string SubstringHTML(string html, int len)
{
return "";
}
/// <summary> /// <summary>
/// 截取指定长度字符 /// 截取指定长度字符
/// </summary> /// </summary>
...@@ -1284,12 +1254,12 @@ namespace Edu.Common.Plugin ...@@ -1284,12 +1254,12 @@ namespace Edu.Common.Plugin
string value = null; string value = null;
if (index >= 0) if (index >= 0)
{ {
key = queryString.Substring(startIndex, index - startIndex); key = queryString[startIndex..index];
value = queryString.Substring(index + 1, (i - index) - 1); value = queryString.Substring(index + 1, (i - index) - 1);
} }
else else
{ {
key = queryString.Substring(startIndex, i - startIndex); key = queryString[startIndex..i];
} }
if (isEncoded) if (isEncoded)
{ {
...@@ -1468,7 +1438,7 @@ namespace Edu.Common.Plugin ...@@ -1468,7 +1438,7 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static string GetStarString(string Input) public static string GetStarString(string Input)
{ {
string Output = ""; string Output;
switch (Input.Length) switch (Input.Length)
{ {
case 1: case 1:
......
...@@ -140,8 +140,8 @@ namespace Edu.Common.Plugin ...@@ -140,8 +140,8 @@ namespace Edu.Common.Plugin
/// </summary> /// </summary>
public class IntRangeValidateAttribute : AbstractValidateAttribute public class IntRangeValidateAttribute : AbstractValidateAttribute
{ {
private int _min = 0; private readonly int _min = 0;
private int _max = 0; private readonly int _max = 0;
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
...@@ -222,8 +222,8 @@ namespace Edu.Common.Plugin ...@@ -222,8 +222,8 @@ namespace Edu.Common.Plugin
/// </summary> /// </summary>
public class StringRangeValidateAttribute : AbstractValidateAttribute public class StringRangeValidateAttribute : AbstractValidateAttribute
{ {
private int _min = 0; private readonly int _min = 0;
private int _max = 0; private readonly int _max = 0;
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
...@@ -380,7 +380,7 @@ namespace Edu.Common.Plugin ...@@ -380,7 +380,7 @@ namespace Edu.Common.Plugin
/// </summary> /// </summary>
public class RegularValidateAttribute : AbstractValidateAttribute public class RegularValidateAttribute : AbstractValidateAttribute
{ {
private string pattern = ""; private readonly string pattern = "";
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
......
...@@ -10,7 +10,7 @@ namespace Edu.Common.Plugin ...@@ -10,7 +10,7 @@ namespace Edu.Common.Plugin
{ {
public class WeiXinHelper public class WeiXinHelper
{ {
static List<WeChatMiniAppMessage> weChatMiniAppMessages = new List<WeChatMiniAppMessage>(); static readonly List<WeChatMiniAppMessage> weChatMiniAppMessages = new List<WeChatMiniAppMessage>();
static WeiXinHelper() static WeiXinHelper()
{ {
...@@ -163,14 +163,10 @@ namespace Edu.Common.Plugin ...@@ -163,14 +163,10 @@ namespace Edu.Common.Plugin
try try
{ {
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url); System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp = wReq.GetResponse(); System.Net.WebResponse wResp = wReq.GetResponse();
System.IO.Stream respStream = wResp.GetResponseStream(); System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream) using System.IO.StreamReader reader = new System.IO.StreamReader(respStream, Encoding.GetEncoding(type));
using (System.IO.StreamReader reader = new System.IO.StreamReader(respStream, Encoding.GetEncoding(type))) return reader.ReadToEnd();
{
return reader.ReadToEnd();
}
} }
catch (System.Exception ex) catch (System.Exception ex)
{ {
...@@ -183,27 +179,27 @@ namespace Edu.Common.Plugin ...@@ -183,27 +179,27 @@ namespace Edu.Common.Plugin
/// <summary> /// <summary>
/// 微信小程序验证返回结果 /// 微信小程序验证返回结果
/// </summary> /// </summary>
public class result public class Result
{ {
/// <summary> /// <summary>
/// openid /// openid
/// </summary> /// </summary>
public string openid { get; set; } public string Openid { get; set; }
/// <summary> /// <summary>
/// session_key /// session_key
/// </summary> /// </summary>
public string session_key { get; set; } public string Session_key { get; set; }
/// <summary> /// <summary>
/// 错误状态码 /// 错误状态码
/// </summary> /// </summary>
public string errcode { get; set; } public string Errcode { get; set; }
/// <summary> /// <summary>
/// 错误提示信息 /// 错误提示信息
/// </summary> /// </summary>
public string errmsg { get; set; } public string Errmsg { get; set; }
} }
#endregion #endregion
...@@ -217,7 +213,7 @@ namespace Edu.Common.Plugin ...@@ -217,7 +213,7 @@ namespace Edu.Common.Plugin
} }
//采用排序的Dictionary的好处是方便对数据包进行签名,不用再签名之前再做一次排序 //采用排序的Dictionary的好处是方便对数据包进行签名,不用再签名之前再做一次排序
private SortedDictionary<string, object> m_values = new SortedDictionary<string, object>(); private readonly SortedDictionary<string, object> m_values = new SortedDictionary<string, object>();
/** /**
* 设置某个字段的值 * 设置某个字段的值
...@@ -236,8 +232,7 @@ namespace Edu.Common.Plugin ...@@ -236,8 +232,7 @@ namespace Edu.Common.Plugin
*/ */
public object GetValue(string key) public object GetValue(string key)
{ {
object o = null; m_values.TryGetValue(key, out object o);
m_values.TryGetValue(key, out o);
return o; return o;
} }
...@@ -248,8 +243,7 @@ namespace Edu.Common.Plugin ...@@ -248,8 +243,7 @@ namespace Edu.Common.Plugin
*/ */
public bool IsSet(string key) public bool IsSet(string key)
{ {
object o = null; m_values.TryGetValue(key, out object o);
m_values.TryGetValue(key, out o);
if (null != o) if (null != o)
return true; return true;
else else
......
...@@ -43,7 +43,6 @@ namespace Edu.Common.Plugin ...@@ -43,7 +43,6 @@ namespace Edu.Common.Plugin
table.Width = 600 * 9; table.Width = 600 * 9;
var rootRow = table.GetRow(0); var rootRow = table.GetRow(0);
var secondRow = table.GetRow(1);
table.SetColumnWidth(0, 150);/* 设置列宽 */ table.SetColumnWidth(0, 150);/* 设置列宽 */
table.SetColumnWidth(1, 250); table.SetColumnWidth(1, 250);
...@@ -140,7 +139,7 @@ namespace Edu.Common.Plugin ...@@ -140,7 +139,7 @@ namespace Edu.Common.Plugin
rpr.AddNewSzCs().val = (ulong)21; rpr.AddNewSzCs().val = (ulong)21;
table.Width = 950 * 5; table.Width = 950 * 5;
var rootRow = table.GetRow(0);
table.SetColumnWidth(0, 100);/* 设置列宽 */ table.SetColumnWidth(0, 100);/* 设置列宽 */
table.SetColumnWidth(1, 200); table.SetColumnWidth(1, 200);
...@@ -222,11 +221,9 @@ namespace Edu.Common.Plugin ...@@ -222,11 +221,9 @@ namespace Edu.Common.Plugin
XWPFDocument doc = null; XWPFDocument doc = null;
if (isTemplate && !string.IsNullOrEmpty(templatePath.Trim())) if (isTemplate && !string.IsNullOrEmpty(templatePath.Trim()))
{ {
using (FileStream file = new FileStream(templatePath, FileMode.Open, FileAccess.Read)) using FileStream file = new FileStream(templatePath, FileMode.Open, FileAccess.Read);
{ //将文件流中模板加载到工作簿对象中
//将文件流中模板加载到工作簿对象中 doc = new XWPFDocument(file);
doc = new XWPFDocument(file);
}
} }
else else
{ {
...@@ -242,13 +239,11 @@ namespace Edu.Common.Plugin ...@@ -242,13 +239,11 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
private static byte[] GetStream(XWPFDocument doc) private static byte[] GetStream(XWPFDocument doc)
{ {
using (MemoryStream ms = new MemoryStream()) using MemoryStream ms = new MemoryStream();
{ doc.Write(ms);
doc.Write(ms); ms.Flush();
ms.Flush(); ms.Position = 0;
ms.Position = 0; return ms.ToArray();
return ms.ToArray();
}
} }
} }
......
using Edu.Model.ViewModel.System; using Edu.Model.ViewModel.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace Edu.Model.CacheModel namespace Edu.Model.CacheModel
{ {
...@@ -60,4 +58,4 @@ namespace Edu.Model.CacheModel ...@@ -60,4 +58,4 @@ namespace Edu.Model.CacheModel
/// </summary> /// </summary>
public string UserIcon { get; set; } public string UserIcon { get; set; }
} }
} }
\ No newline at end of file
using Edu.Common.Enum; using Edu.Common.Enum;
using System; using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Model.Entity.Course namespace Edu.Model.Entity.Course
...@@ -68,4 +66,4 @@ namespace Edu.Model.Entity.Course ...@@ -68,4 +66,4 @@ namespace Edu.Model.Entity.Course
/// </summary> /// </summary>
public int School_Id { get; set; } public int School_Id { get; set; }
} }
} }
\ No newline at end of file
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Common.Enum.User; using Edu.Common.Enum.User;
using System; using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Model.Entity.User namespace Edu.Model.Entity.User
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Common.Plugin;
using Newtonsoft.Json;
using System; using System;
using VT.FW.DB; using VT.FW.DB;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using System; using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Model.Entity.User namespace Edu.Model.Entity.User
......
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Course
{
/// <summary>
/// 课程分类树形结构实体类
/// </summary>
public class CourseCategoryTree_ViewModel
{
/// <summary>
/// 主键(课程分类编号)
/// </summary>
public int CateId { get; set; }
/// <summary>
/// 父级编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 课程分类名称
/// </summary>
public string CateName { get; set; }
/// <summary>
/// 分类下级列表
/// </summary>
public List<CourseCategoryTree_ViewModel> ChildList { get; set; }
}
}
\ No newline at end of file
using System; using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Model.ViewModel.Course namespace Edu.Model.ViewModel.Course
......
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System namespace Edu.Model.ViewModel.System
{ {
......
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System namespace Edu.Model.ViewModel.System
{ {
......
using System; namespace Edu.Model.ViewModel.System
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System
{ {
/// <summary> /// <summary>
/// 地区视图实体类 /// 地区视图实体类
...@@ -15,8 +11,8 @@ namespace Edu.Model.ViewModel.System ...@@ -15,8 +11,8 @@ namespace Edu.Model.ViewModel.System
public string NameStr { get; set; } public string NameStr { get; set; }
/// <summary> /// <summary>
/// 多个编号【逗号分割】 /// 多个编号【逗号分割】
/// </summary> /// </summary>
public string Ids { get; set; } public string Ids { get; set; }
} }
} }
\ No newline at end of file
using System; namespace Edu.Model.ViewModel.System
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System
{ {
/// <summary> /// <summary>
/// 系统菜单视图实体类 /// 系统菜单视图实体类
......
using System; namespace Edu.Model.ViewModel.System
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.System
{ {
/// <summary> /// <summary>
/// 系统角色视图实体类 /// 系统角色视图实体类
/// </summary> /// </summary>
public class RB_Role_ViewModel : Model.Entity.System.RB_Role public class RB_Role_ViewModel : Model.Entity.System.RB_Role
{ {
} }
} }
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.User namespace Edu.Model.ViewModel.User
{ {
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Repository.Course; using Edu.Repository.Course;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Linq;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.Course namespace Edu.Module.Course
...@@ -51,6 +50,60 @@ namespace Edu.Module.Course ...@@ -51,6 +50,60 @@ namespace Edu.Module.Course
return categoryRepository.GetEntity<RB_Course_Category_ViewModel>(CateId); return categoryRepository.GetEntity<RB_Course_Category_ViewModel>(CateId);
} }
/// <summary>
/// 获取课程分类树形列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<CourseCategoryTree_ViewModel> GetCourseCategoryTreeListModule(RB_Course_Category_ViewModel query)
{
List<CourseCategoryTree_ViewModel> treeList = new List<CourseCategoryTree_ViewModel>();
var list = GetCourseCategoryListModule(query);
if (list != null && list.Count > 0)
{
var firstList = list.Where(qitem => qitem.ParentId == 0).ToList();
if (firstList != null && firstList.Count > 0)
{
foreach (var fItem in firstList)
{
CourseCategoryTree_ViewModel tModel = new CourseCategoryTree_ViewModel()
{
CateId = fItem.CateId,
CateName = fItem.CateName,
ParentId = fItem.ParentId,
ChildList = new List<CourseCategoryTree_ViewModel>()
};
tModel.ChildList = GetCategoryTreeList(fItem.CateId, list);
treeList.Add(tModel);
}
}
}
return treeList;
}
/// <summary>
/// 递归生成树形结构
/// </summary>
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
private List<CourseCategoryTree_ViewModel> GetCategoryTreeList(int parentId, List<RB_Course_Category_ViewModel> sourceList)
{
List<CourseCategoryTree_ViewModel> treeList = new List<CourseCategoryTree_ViewModel>();
foreach (var item in sourceList.Where(qitem => qitem.ParentId == parentId))
{
CourseCategoryTree_ViewModel model = new CourseCategoryTree_ViewModel()
{
CateId = item.CateId,
CateName = item.CateName,
ParentId = item.ParentId,
ChildList = new List<CourseCategoryTree_ViewModel>(),
};
model.ChildList = GetCategoryTreeList(item.CateId, sourceList);
treeList.Add(model);
}
return treeList;
}
/// <summary> /// <summary>
/// 新增修改课程分类 /// 新增修改课程分类
/// </summary> /// </summary>
......
using Edu.Model.ViewModel.System; using Edu.Model.ViewModel.System;
using Edu.Repository.System; using Edu.Repository.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Linq; using System.Linq;
namespace Edu.Module.System namespace Edu.Module.System
......
using Edu.Model.ViewModel.System; using Edu.Model.ViewModel.System;
using Edu.Repository.System; using Edu.Repository.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.System namespace Edu.Module.System
......
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.User; using Edu.Repository.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.User namespace Edu.Module.User
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.User; using Edu.Repository.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.User namespace Edu.Module.User
......
...@@ -7,7 +7,6 @@ using Edu.Repository.User; ...@@ -7,7 +7,6 @@ using Edu.Repository.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Edu.Module.User namespace Edu.Module.User
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Model.Entity.System; using Edu.Model.ViewModel.System;
using Edu.Model.ViewModel.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.System; using Edu.Model.ViewModel.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.System; using Edu.Model.ViewModel.System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
......
using System; using Edu.Common;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common;
using Edu.Common.API; using Edu.Common.API;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.WebApi.Filter; using Edu.WebApi.Filter;
...@@ -11,7 +6,6 @@ using Microsoft.AspNetCore.Cors; ...@@ -11,7 +6,6 @@ using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Web;
using Edu.Model.CacheModel; using Edu.Model.CacheModel;
using Edu.Cache.User; using Edu.Cache.User;
......
using System; using System;
using System.Collections.Generic; using Edu.Cache.User;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API; using Edu.Common.API;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Module.Course; using Edu.Module.Course;
using Edu.WebApi.Filter; using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.Course namespace Edu.WebApi.Controllers.Course
...@@ -37,6 +34,17 @@ namespace Edu.WebApi.Controllers.Course ...@@ -37,6 +34,17 @@ namespace Edu.WebApi.Controllers.Course
query.Group_Id = base.UserInfo.Group_Id; query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id; query.School_Id = base.UserInfo.School_Id;
var list = categoryModule.GetCourseCategoryPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query); var list = categoryModule.GetCourseCategoryPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
if (item.UpdateBy > 0)
{
item.UpdateByName = UserReidsCache.GetUserLoginInfo(item.UpdateBy)?.AccountName ?? "";
}
}
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
pageModel.PageData = list; pageModel.PageData = list;
return ApiResult.Success(data: pageModel); return ApiResult.Success(data: pageModel);
...@@ -56,6 +64,19 @@ namespace Edu.WebApi.Controllers.Course ...@@ -56,6 +64,19 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
/// <summary>
/// 获取课程分类树形列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCourseCategoryTree()
{
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Course_Category_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var list = categoryModule.GetCourseCategoryTreeListModule(query);
return ApiResult.Success(data: list);
}
/// <summary> /// <summary>
/// 添加修改课程分类 /// 添加修改课程分类
...@@ -69,6 +90,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -69,6 +90,8 @@ namespace Edu.WebApi.Controllers.Course
extModel.CreateBy = base.UserInfo.Id; extModel.CreateBy = base.UserInfo.Id;
extModel.UpdateBy = base.UserInfo.Id; extModel.UpdateBy = base.UserInfo.Id;
extModel.UpdateTime = DateTime.Now; extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = this.UserInfo.Group_Id;
extModel.School_Id = this.UserInfo.School_Id;
bool flag = categoryModule.SetCourseCategoryModule(extModel); bool flag = categoryModule.SetCourseCategoryModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
......
...@@ -28,7 +28,7 @@ namespace Edu.WebApi.Filter ...@@ -28,7 +28,7 @@ namespace Edu.WebApi.Filter
{ {
string token = ""; string token = "";
//请求参数 //请求参数
JObject parm = DoApiMonitorLog(actionContext, ref token); DoApiMonitorLog(actionContext, ref token);
bool isCheckToken = true; bool isCheckToken = true;
var endpoint = actionContext.HttpContext.Features.Get<IEndpointFeature>()?.Endpoint; var endpoint = actionContext.HttpContext.Features.Get<IEndpointFeature>()?.Endpoint;
if (endpoint != null && endpoint.Metadata.GetMetadata<AllowAnonymousAttribute>() != null) if (endpoint != null && endpoint.Metadata.GetMetadata<AllowAnonymousAttribute>() != null)
...@@ -149,7 +149,7 @@ namespace Edu.WebApi.Filter ...@@ -149,7 +149,7 @@ namespace Edu.WebApi.Filter
} }
catch (Exception ex) catch (Exception ex)
{ {
string message = ex.Message; Common.Plugin.LogHelper.Write(ex, "JWTValidat3");
actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult( actionContext.Result = new Microsoft.AspNetCore.Mvc.JsonResult(
HttpStatusCode.OK, HttpStatusCode.OK,
new ApiResult new ApiResult
......
...@@ -5,8 +5,6 @@ using JWT.Serializers; ...@@ -5,8 +5,6 @@ using JWT.Serializers;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Helper namespace Edu.WebApi.Helper
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment