Commit 919732a5 authored by liuxiaohui's avatar liuxiaohui

UploadFile The Server

parent 0f7bb16e
......@@ -35,10 +35,11 @@
"ApiKey": "Uicm6VMjVPdzepbqnwNvpl25xJjRxFekMV8QZdeTLTwacNBl"
},
"ConnectionStrings": {
"Default": "Host=yg-sql-dev-wan.pg.rds.aliyuncs.com;Port=5432;Database=BBMChatGLM;User ID=yg;Password=YG@sql!dev2022123;",
"Default": "Host=yg-sql-dev-wan.pg.rds.aliyuncs.com;Port=5432;Database=BBMChatGLM;User ID=yg;Password=YG@sql!dev2022123;"
},
"Redis": {
"Configuration": "yg-redis-dev-wan.redis.rds.aliyuncs.com:6379,password=YG@redis!dev2022123,defaultDatabase=5"
},
"Jwt": {
"Audience": "BBM.ChatGLM",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -3,6 +3,8 @@ using BBM.ChatGLM.User;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using OfficeOpenXml;
using System;
using System.IO;
using System.Text.RegularExpressions;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Identity;
......@@ -77,14 +79,15 @@ namespace BBM.ChatGLM.Controllers
Dtos.Results xiangying = new Dtos.Results();
var failNum = 0;
if (file == null)
return BadRequest("Excel文件为空");
var fileName = file.FileName;
var filePath = Path.Combine("C:\\Excel", fileName);
string directoryPath = Environment.CurrentDirectory + @"\Excels";
if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);
var filePath = Path.Combine(directoryPath, file.FileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
......@@ -97,9 +100,10 @@ namespace BBM.ChatGLM.Controllers
var totalRows = worksheet.Dimension.Rows;
var row = 2;
var userName = "";
var userName = "";
var phoneNumber = "";
var userRole = "";
var userRole = "";
while (row <= totalRows)
{
......@@ -139,7 +143,7 @@ namespace BBM.ChatGLM.Controllers
userInput.Role = userRole;
userInput.IsActive = true;
var userDto = await _usersAppService.CreateAsync(userInput);
await _usersAppService.CreateAsync(userInput);
continue;
}
}
......
......@@ -466,7 +466,8 @@ const UserManage = () => {
options={false}
headerTitle="账号列表"
toolBarRender={() => [
<Button onClick={downloadExcelTemplate}>批量添加用户Excel模板</Button>,
<Button>
<a href='https://baibaomen.oss-cn-hangzhou.aliyuncs.com/zhensheng/excelTemplate.xlsx'>批量添加用户Excel模板</a></Button>,
<Upload
beforeUpload={handleUpload}
disabled={uploadButtonDisable}
......
......@@ -5,7 +5,6 @@ interface ILoginParams {
password: string;
}
const request = extend({});
let host = "";
......@@ -30,7 +29,6 @@ request.interceptors.request.use((url, options) => {
Authorization: `Bearer ${token || ''}`,
'Content-Type': 'application/json',
__tenant: '3a0a90fe-9a0d-70f4-200d-a80a41fb6195',
};
}
return {
......@@ -200,7 +198,7 @@ export const postExcelFile = (file) => {
export const postDowload = () => {
return request('Template.xlsx', {
method: 'GET',
responseType: 'blob', // 将响应类型设置为二进制流
responseType: 'blob', // 将响应类型设置为二进制流
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response]));
const link = document.createElement('a');
......
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