diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db
index 2b7e921a..dca11648 100644
Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs
index 23c825f3..9161b748 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Appsettings.cs
@@ -11,8 +11,8 @@ namespace Yi.Framework.WebCore
///
public class Appsettings
{
- static IConfiguration Configuration { get; set; }
- static string contentPath { get; set; }
+ static IConfiguration? Configuration { get; set; }
+ static string? contentPath { get; set; }
public Appsettings(string contentPath)
{
@@ -37,14 +37,14 @@ namespace Yi.Framework.WebCore
///
/// 节点配置
///
- public static string app(params string[] sections)
+ public static string? app(params string[] sections)
{
try
{
if (sections.Any())
{
- return Configuration[string.Join(":", sections)];
+ return Configuration?[string.Join(":", sections)];
}
}
catch (Exception) { }
@@ -59,7 +59,7 @@ namespace Yi.Framework.WebCore
}
- public static bool Bool(object thisValue)
+ public static bool Bool(object? thisValue)
{
bool reval = false;
if (thisValue != null && thisValue != DBNull.Value && bool.TryParse(thisValue.ToString(), out reval))
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs
index 4b02390e..20e5e3d1 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/AttributeExtend/GlobalLogAttribute.cs
@@ -35,9 +35,8 @@ namespace Yi.Framework.WebCore.AttributeExtend
if (context.ActionDescriptor is not ControllerActionDescriptor controllerActionDescriptor) return;
//查找标签,获取标签对象
- LogAttribute logAttribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true)
+ LogAttribute? logAttribute = controllerActionDescriptor.MethodInfo.GetCustomAttributes(inherit: true)
.FirstOrDefault(a => a.GetType().Equals(typeof(LogAttribute))) as LogAttribute;
-
//空对象直接返回
if (logAttribute is null) return;
@@ -72,7 +71,7 @@ namespace Yi.Framework.WebCore.AttributeExtend
{
if (context.Result is ContentResult result && result.ContentType == "application/json")
{
- logEntity.RequestResult = result.Content.Replace("\r\n", "").Trim();
+ logEntity.RequestResult = result.Content?.Replace("\r\n", "").Trim();
}
if (context.Result is JsonResult result2)
{
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs
index 313fce11..6005cdc6 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/BuilderExtend/ApolloExtension.cs
@@ -50,8 +50,8 @@ namespace Yi.Framework.WebCore.BuilderExtend
{
foreach (var apolloProvider in root.Providers.Where(p => p is ApolloConfigurationProvider))
{
- var property = apolloProvider.GetType().BaseType.GetProperty("Data", BindingFlags.Instance | BindingFlags.NonPublic);
- var data = property.GetValue(apolloProvider) as IDictionary;
+ var property = apolloProvider.GetType().BaseType?.GetProperty("Data", BindingFlags.Instance | BindingFlags.NonPublic);
+ var data = property?.GetValue(apolloProvider) as IDictionary;
foreach (var item in data)
{
Console.WriteLine($"key {item.Key} value {item.Value}");
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs
index 790e85be..784be41e 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/CommonExtend/HttpContextExtend.cs
@@ -50,7 +50,7 @@ namespace Yi.Framework.WebCore
///
///
///
- public static string GetUserNameInfo(this HttpContext httpContext)
+ public static string? GetUserNameInfo(this HttpContext httpContext)
{
var p = httpContext;
return httpContext.User.Claims.FirstOrDefault(u => u.Type == "userName")?.Value;
@@ -61,10 +61,10 @@ namespace Yi.Framework.WebCore
///
///
///
- public static string GetDeptIdInfo(this HttpContext httpContext)
+ public static string? GetDeptIdInfo(this HttpContext httpContext)
{
var p = httpContext;
- return httpContext.User.Claims.FirstOrDefault(u => u.Type == "deptId").Value;
+ return httpContext.User.Claims.FirstOrDefault(u => u.Type == "deptId")?.Value;
}
///
@@ -72,10 +72,10 @@ namespace Yi.Framework.WebCore
///
///
///
- public static string GetPermissionInfo(this HttpContext httpContext)
+ public static string? GetPermissionInfo(this HttpContext httpContext)
{
var p = httpContext;
- return httpContext.User.Claims.FirstOrDefault(u => u.Type == "permission").Value;
+ return httpContext.User.Claims.FirstOrDefault(u => u.Type == "permission")?.Value;
}
@@ -87,7 +87,7 @@ namespace Yi.Framework.WebCore
///
public static UserEntity GetUserEntityInfo(this HttpContext httpContext, out List menuIds)
{
- IEnumerable claimlist = null;
+ IEnumerable? claimlist = null;
long resId = 0;
try
{
@@ -139,7 +139,7 @@ namespace Yi.Framework.WebCore
{
string res = "zh-CN";
var str = httpContext.Request.Headers["Accept-Language"].FirstOrDefault();
- if (str.IsNotNull())
+ if (str is not null)
{
res = str.Split(",")[0];
}
@@ -167,7 +167,7 @@ namespace Yi.Framework.WebCore
}
else
{
- param = context.Request.QueryString.Value.ToString();
+ param = context.Request.QueryString.Value is null?"": context.Request.QueryString.Value.ToString();
}
return param;
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
index 59aeb3d2..c749a4d9 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbFiterExtend.cs
@@ -44,12 +44,13 @@ namespace Yi.Framework.Core
roles = new();
}
//先测试部门就是LEBG
- long deptId = (long)userRoleMenu.User.DeptId;
+ long deptId = userRoleMenu.User.DeptId??-1;
long userId = httpContext.GetUserIdInfo();
//根据角色的数据范围,来添加相对于的数据权限
foreach (var role in roles)
{
- DataScopeEnum dataScope = (DataScopeEnum)role.DataScope;
+ //默认为全部
+ DataScopeEnum dataScope = (DataScopeEnum)(role.DataScope?? DataScopeEnum.ALL.GetHashCode());
switch (dataScope)
{
case DataScopeEnum.ALL:
@@ -71,8 +72,9 @@ namespace Yi.Framework.Core
case DataScopeEnum.DEPT_FOLLOW:
//放行自己部门及以下
var allChildDepts = db.Queryable().ToChildList(it => it.ParentId, deptId);
+
+ var filter1 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains(it.DeptId??-1), true);
- var filter1 = new TableFilterItem(it => allChildDepts.Select(f => f.Id).ToList().Contains((long)it.DeptId), true);
db.QueryFilter.Add(filter1);
//部门无需过滤
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs
index 0af7e9f8..23af7be8 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomExceptionFilterAttribute.cs
@@ -15,7 +15,7 @@ namespace Yi.Framework.WebCore.FilterExtend
///
public class CustomExceptionFilterAttribute : IExceptionFilter
{
- private ILogger _logger = null;
+ private ILogger _logger;
public CustomExceptionFilterAttribute(ILogger logger)
{
this._logger = logger;
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs
index 77a08bcf..985117ab 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/FilterExtend/CustomIOCFilterFactoryAttribute.cs
@@ -11,7 +11,7 @@ namespace Yi.Framework.WebCore.FilterExtend
///
public class CustomIOCFilterFactoryAttribute : Attribute, IFilterFactory
{
- private readonly Type _FilterType = null;
+ private readonly Type _FilterType;
public CustomIOCFilterFactoryAttribute(Type type)
{
@@ -23,7 +23,7 @@ namespace Yi.Framework.WebCore.FilterExtend
{
//return (IFilterMetadata)serviceProvider.GetService(typeof(CustomExceptionFilterAttribute));
- return (IFilterMetadata)serviceProvider.GetService(this._FilterType);
+ return (IFilterMetadata)serviceProvider.GetService(this._FilterType)!;
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs
index e48a59f4..29f36b3b 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/SqlsugarExtension.cs
@@ -11,7 +11,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
{
public static class SqlsugarExtension
{
- public static void AddSqlsugarServer(this IServiceCollection services, Action action = null)
+ public static void AddSqlsugarServer(this IServiceCollection services, Action? action = null)
{
DbType dbType;
var slavaConFig = new List();
@@ -60,7 +60,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
},
db =>
{
- if (action.IsNotNull())
+ if (action is not null)
{
action(db);
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs
index 429fdce7..758244f6 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/StaticPageExtension.cs
@@ -31,7 +31,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
{
if (this._supportDelete && "Delete".Equals(context.Request.Query["ActionHeader"]))
{
- this.DeleteHmtl(context.Request.Path.Value);
+ this.DeleteHmtl(context.Request.Path.Value??"");
context.Response.StatusCode = 200;
}
else if (this._supportWarmup && "ClearAll".Equals(context.Request.Query["ActionHeader"]))
@@ -52,7 +52,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
copyStream.Position = 0;
var reader = new StreamReader(copyStream);
var content = await reader.ReadToEndAsync();
- string url = context.Request.Path.Value;
+ string url = context.Request.Path.Value??"";
this.SaveHmtl(url, content);
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs
index d1baf01f..1617fa1e 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/MainHub.cs
@@ -16,7 +16,7 @@ namespace Yi.Framework.WebCore.SignalRHub
public static readonly List clientUsers = new();
- private HttpContext _httpContext;
+ private HttpContext? _httpContext;
private ILogger _logger;
public MainHub(IHttpContextAccessor httpContextAccessor,ILogger logger)
{
@@ -32,11 +32,11 @@ namespace Yi.Framework.WebCore.SignalRHub
///
public override Task OnConnectedAsync()
{
- var name = _httpContext.GetUserNameInfo();
- var loginUser = _httpContext.GetLoginLogInfo();
+ var name = _httpContext?.GetUserNameInfo();
+ var loginUser = _httpContext?.GetLoginLogInfo();
var user = clientUsers.Any(u => u.ConnnectionId == Context.ConnectionId);
//判断用户是否存在,否则添加集合
- if (!user && Context.User.Identity.IsAuthenticated)
+ if (!user && (Context.User?.Identity?.IsAuthenticated??false))
{
OnlineUser users = new(Context.ConnectionId)
{
@@ -45,7 +45,7 @@ namespace Yi.Framework.WebCore.SignalRHub
Ipaddr= loginUser.LoginIp,
LoginTime=DateTime.Now,
Os=loginUser.Os,
- UserName= name
+ UserName= name??""
};
clientUsers.Add(users);
_logger.LogInformation($"{DateTime.Now}:{name},{Context.ConnectionId}连接服务端success,当前已连接{clientUsers.Count}个");
@@ -63,7 +63,7 @@ namespace Yi.Framework.WebCore.SignalRHub
///
///
///
- public override Task OnDisconnectedAsync(Exception exception)
+ public override Task OnDisconnectedAsync(Exception? exception)
{
var user = clientUsers.Where(p => p.ConnnectionId == Context.ConnectionId).FirstOrDefault();
//判断用户是否存在,否则添加集合
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs
index 8b3259d2..ac58ab1a 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/SignalRHub/OnlineUser.cs
@@ -19,18 +19,18 @@ namespace Yi.Framework.WebCore.SignalRHub
///
/// 客户端连接Id
///
- public string ConnnectionId { get; }
+ public string? ConnnectionId { get; }
///
/// 用户id
///
public long? UserId { get; set; }
- public string UserName { get; set; }
- public DateTime LoginTime { get; set; }
- public string Ipaddr { get; set; }
- public string LoginLocation { get; set; }
+ public string? UserName { get; set; }
+ public DateTime? LoginTime { get; set; }
+ public string? Ipaddr { get; set; }
+ public string? LoginLocation { get; set; }
- public string Os { get; set; }
- public string Browser { get; set; }
+ public string? Os { get; set; }
+ public string? Browser { get; set; }
}
diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj b/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj
index bc7336af..a24eeae2 100644
--- a/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj
+++ b/Yi.Framework.Net6/Yi.Framework.WebCore/Yi.Framework.WebCore.csproj
@@ -2,6 +2,7 @@
net6.0
+ enable
diff --git a/Yi.Vue3.x.Vant/components.d.ts b/Yi.Vue3.x.Vant/components.d.ts
index b04c459e..71bae129 100644
--- a/Yi.Vue3.x.Vant/components.d.ts
+++ b/Yi.Vue3.x.Vant/components.d.ts
@@ -31,6 +31,8 @@ declare module '@vue/runtime-core' {
VanPullRefresh: typeof import('vant/es')['PullRefresh']
VanRow: typeof import('vant/es')['Row']
VanSticky: typeof import('vant/es')['Sticky']
+ VanSwipe: typeof import('vant/es')['Swipe']
+ VanSwipeItem: typeof import('vant/es')['SwipeItem']
VanTab: typeof import('vant/es')['Tab']
VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem']
diff --git a/Yi.Vue3.x.Vant/src/layout/bottom/index.vue b/Yi.Vue3.x.Vant/src/layout/bottom/index.vue
index 0f607970..a955d1f4 100644
--- a/Yi.Vue3.x.Vant/src/layout/bottom/index.vue
+++ b/Yi.Vue3.x.Vant/src/layout/bottom/index.vue
@@ -35,6 +35,7 @@ let tabbar=ref([
{icon:"wap-home",to:"/",title:"主页"},
{icon:"location-o",to:"",title:"发现"},
{icon:"",to:"",title:""},
+ // {icon:"friends-o",to:"/shopIndex",title:"商城"},
{icon:"friends-o",to:"",title:"商城"},
{icon:"setting-o",to:"/my",title:"我的"},
])
@@ -43,6 +44,7 @@ const onChange=(index:number)=>{
{icon:"wap-home-o",to:"/",title:"主页"},
{icon:"location-o",to:"",title:"发现"},
{icon:"",to:"",title:""},
+ // {icon:"friends-o",to:"/shopIndex",title:"商城"},
{icon:"friends-o",to:"",title:"商城"},
{icon:"setting-o",to:"/my",title:"我的"},
];
diff --git a/Yi.Vue3.x.Vant/src/layout/head/index.vue b/Yi.Vue3.x.Vant/src/layout/head/index.vue
new file mode 100644
index 00000000..d012f2e0
--- /dev/null
+++ b/Yi.Vue3.x.Vant/src/layout/head/index.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Yi.Vue3.x.Vant/src/router/index.ts b/Yi.Vue3.x.Vant/src/router/index.ts
index 4337c530..2ea52cdf 100644
--- a/Yi.Vue3.x.Vant/src/router/index.ts
+++ b/Yi.Vue3.x.Vant/src/router/index.ts
@@ -1,14 +1,20 @@
import { createWebHistory, createRouter } from 'vue-router';
import Layout from '@/layout/index.vue';
+import HeadLayout from '@/layout/head/index.vue'
export const constantRoutes = [
-
+
{
name:'Layout',
path: '/',
component: Layout,
redirect:"/recommend",
children: [
+ {
+ path: '/shopIndex',
+ component: () => import('@/view/shop/shopIndex.vue'),
+ name: 'ShopIndex',
+ },
{
path: '/my',
component: () => import('@/view/my.vue'),
@@ -49,6 +55,25 @@ export const constantRoutes = [
component: () => import('@/view/login.vue'),
name: 'Login',
},
+
+ {
+ name:'Shop',
+ path: '/shop',
+ component: HeadLayout,
+ redirect:"/shopIndex",
+ children: [
+ {
+ path: '/shopDetails',
+ component: () => import('@/view/shop/shopDetails.vue'),
+ name: 'ShopDetails',
+ },
+ {
+ path: '/shopSearch',
+ component: () => import('@/view/shop/shopSearch.vue'),
+ name: 'ShopSearch',
+ },
+ ]
+ }
];
const router = createRouter({
diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue b/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue
new file mode 100644
index 00000000..f99b463c
--- /dev/null
+++ b/Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue
@@ -0,0 +1,5 @@
+
+ 这里是商品详情页
+
+ 返回商品首页
+
\ No newline at end of file
diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue b/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue
new file mode 100644
index 00000000..5880c164
--- /dev/null
+++ b/Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue
@@ -0,0 +1,23 @@
+
+ 这里是商城主页
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+ 点击前往搜索
+
+
+
\ No newline at end of file
diff --git a/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue b/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue
new file mode 100644
index 00000000..904850e1
--- /dev/null
+++ b/Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue
@@ -0,0 +1,7 @@
+
+ 这里是商品搜索页
+
+ 点击进入商品详情
+
+ 返回商品首页
+
\ No newline at end of file