feat:修改使用mysql
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import useUserStore from '@/stores/user'
|
||||
import { reactive, watch, onMounted, computed } from 'vue';
|
||||
import { reactive, watch, onMounted, computed, ref } from 'vue';
|
||||
//userInfo
|
||||
//{icon,name,role,id},根据判断userInfo是否等于未定义,来觉得是当前登录用户信息,还是其他人信息
|
||||
const props = defineProps(['size', 'showWatching', 'time', 'userInfo', 'isSelf'])
|
||||
@@ -39,20 +39,14 @@ const userInfo = reactive({
|
||||
role: [],
|
||||
id: ""
|
||||
});
|
||||
|
||||
const iconUrl = computed(() => {
|
||||
const iconUrl=ref('/src/assets/logo.ico');
|
||||
const iconUrlHandler = () => {
|
||||
if (userInfo.icon == null || userInfo.icon == undefined || userInfo.icon == '') {
|
||||
|
||||
return '/src/assets/logo.ico';
|
||||
}
|
||||
|
||||
if (userInfo.icon.includes(import.meta.env.VITE_APP_BASEAPI)) {
|
||||
return userInfo.icon;
|
||||
}
|
||||
|
||||
|
||||
return `${import.meta.env.VITE_APP_BASEAPI}/file/${userInfo.icon}`;
|
||||
})
|
||||
}
|
||||
|
||||
watch(userStore, (n) => {
|
||||
if (props.userInfo == undefined) {
|
||||
@@ -76,14 +70,18 @@ const Init = () => {
|
||||
userInfo.nick = props.userInfo.nick;
|
||||
userInfo.role = props.userInfo.role;
|
||||
userInfo.id = props.userInfo.id;
|
||||
iconUrl.value=iconUrlHandler(userInfo.icon)
|
||||
}
|
||||
|
||||
//使用当前登录用户
|
||||
else {
|
||||
|
||||
userInfo.icon = userStore.icon;
|
||||
userInfo.nick = userStore.name;
|
||||
userInfo.role = userStore.role;
|
||||
userInfo.id = userStore.id;
|
||||
iconUrl.value=userInfo.icon;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ const useUserStore = defineStore('user',
|
||||
// this.permissions=["*:*:*"]
|
||||
this.name = user.nick
|
||||
this.icon = avatar;
|
||||
|
||||
this.userName=user.userName;
|
||||
this.id=user.id;
|
||||
resolve(res)
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Yi.Framework.Core.Sqlsugar
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
SqlSugarClient = new SqlSugarScope(new ConnectionConfig()
|
||||
SqlSugarClient = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
//准备添加分表分库
|
||||
DbType = dbConnOptions.DbType ?? DbType.Sqlite,
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace Yi.Framework.Data.DataSeeds
|
||||
/// <returns></returns>
|
||||
public virtual async Task<bool> IsInvoker()
|
||||
{
|
||||
var p = await _repository.IsAnyAsync(x=>true);
|
||||
var p2 = await _repository.CountAsync(x => true);
|
||||
if (await _repository.CountAsync(u => true) > 0)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.BBS.Domain;
|
||||
using Yi.RBAC.Sqlsugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Yi.BBS.Web;
|
||||
using Yi.Framework.Core.Module;
|
||||
using NLog.Extensions.Logging;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); });
|
||||
@@ -23,7 +24,8 @@ builder.Host.ConfigureAutoFacContainer(container =>
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var db = app.Services.GetService<ISqlSugarClient>();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
app.UseErrorHandlingServer();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Sqlite",
|
||||
//"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Mysql",
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Sqlsugar;
|
||||
using Yi.BBS.Domain;
|
||||
using Yi.RBAC.Sqlsugar;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace Yi.BBS.Sqlsugar
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Yi.BBS.Web;
|
||||
using Yi.Framework.Core.Module;
|
||||
using NLog.Extensions.Logging;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); });
|
||||
@@ -23,7 +24,8 @@ builder.Host.ConfigureAutoFacContainer(container =>
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
var db = app.Services.GetService<ISqlSugarClient>();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
app.UseErrorHandlingServer();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
"DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ],
|
||||
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
//"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Sqlite",
|
||||
//"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"Url": "server=106.52.94.217;port=3306;database=yi-bbs-dev;user id=root;password=Qz52013142020.",
|
||||
"DbType": "Mysql",
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
|
||||
Reference in New Issue
Block a user