修复后端bug
This commit is contained in:
@@ -112,7 +112,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
var uid= pwdDto.user.id;
|
var uid= pwdDto.user.id;
|
||||||
var user_data = await _userService.GetUserById(uid);
|
var user_data = await _userService.GetUserById(uid);
|
||||||
string msg = "修改成功";
|
string msg = "修改成功";
|
||||||
if (pwdDto.newPassword != null)
|
if (! string.IsNullOrEmpty( pwdDto.newPassword))
|
||||||
{
|
{
|
||||||
if (user_data.password == pwdDto.user.password)
|
if (user_data.password == pwdDto.user.password)
|
||||||
{
|
{
|
||||||
@@ -124,9 +124,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
user_data.age = pwdDto.user.age;
|
user_data.age = pwdDto.user.age;
|
||||||
user_data.address = pwdDto.user.address;
|
user_data.address = pwdDto.user.address;
|
||||||
user_data.nick = pwdDto.user.nick;
|
user_data.nick = pwdDto.user.nick;
|
||||||
|
|
||||||
|
|
||||||
await _userService.UpdateAsync(user_data);
|
await _userService.UpdateAsync(user_data);
|
||||||
user_data.password = null;
|
user_data.password = null;
|
||||||
return Result.Success(msg).SetData(user_data);
|
return Result.Success(msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -141,9 +143,11 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
user_data.age = pwdDto.user.age;
|
user_data.age = pwdDto.user.age;
|
||||||
user_data.address = pwdDto.user.address;
|
user_data.address = pwdDto.user.address;
|
||||||
user_data.nick = pwdDto.user.nick;
|
user_data.nick = pwdDto.user.nick;
|
||||||
|
|
||||||
await _userService.UpdateAsync(user_data);
|
await _userService.UpdateAsync(user_data);
|
||||||
user_data.password = null;
|
|
||||||
return Result.Success(msg).SetData(user_data);
|
|
||||||
|
return Result.Success(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
76
Yi.Framework/Yi.Framework.Common/Helper/HttpHelper.cs
Normal file
76
Yi.Framework/Yi.Framework.Common/Helper/HttpHelper.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Common.Helper
|
||||||
|
{
|
||||||
|
public static class HttpHelper
|
||||||
|
{
|
||||||
|
public static string HttpGet(string Url, string postDataStr="")
|
||||||
|
{
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr);
|
||||||
|
request.Method = "GET";
|
||||||
|
request.ContentType = "text/html;charset=UTF-8";
|
||||||
|
|
||||||
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||||
|
Stream myResponseStream = response.GetResponseStream();
|
||||||
|
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
|
||||||
|
string retString = myStreamReader.ReadToEnd();
|
||||||
|
myStreamReader.Close();
|
||||||
|
myResponseStream.Close();
|
||||||
|
|
||||||
|
return retString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool HttpIOGet(string Url, string file, string postDataStr="")
|
||||||
|
{
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url + (postDataStr == "" ? "" : "?") + postDataStr);
|
||||||
|
request.Method = "GET";
|
||||||
|
request.ContentType = "text/html;charset=UTF-8";
|
||||||
|
|
||||||
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||||
|
Stream myResponseStream = response.GetResponseStream();
|
||||||
|
FileStream writer = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int c;
|
||||||
|
while ((c = myResponseStream.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
|
{
|
||||||
|
writer.Write(buffer, 0, c);
|
||||||
|
}
|
||||||
|
writer.Close();
|
||||||
|
myResponseStream.Close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string HttpPost(string Url, string postDataStr="")
|
||||||
|
{
|
||||||
|
CookieContainer cookie = new CookieContainer();
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
|
||||||
|
request.Method = "POST";
|
||||||
|
request.ContentType = "application/x-www-form-urlencoded";
|
||||||
|
request.ContentLength = Encoding.UTF8.GetByteCount(postDataStr);
|
||||||
|
request.CookieContainer = cookie;
|
||||||
|
Stream myRequestStream = request.GetRequestStream();
|
||||||
|
StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312"));
|
||||||
|
myStreamWriter.Write(postDataStr);
|
||||||
|
myStreamWriter.Close();
|
||||||
|
|
||||||
|
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||||
|
|
||||||
|
response.Cookies = cookie.GetCookies(response.ResponseUri);
|
||||||
|
Stream myResponseStream = response.GetResponseStream();
|
||||||
|
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
|
||||||
|
string retString = myStreamReader.ReadToEnd();
|
||||||
|
myStreamReader.Close();
|
||||||
|
myResponseStream.Close();
|
||||||
|
|
||||||
|
return retString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -124,9 +124,7 @@ namespace Yi.Framework.Service
|
|||||||
}
|
}
|
||||||
public async Task<user> GetUserInfoById(int user_id)
|
public async Task<user> GetUserInfoById(int user_id)
|
||||||
{
|
{
|
||||||
var user_data=await _Db.Set<user>().Include(u=>u.roles)
|
var user_data=await GetUserById(user_id);
|
||||||
.Where(u => u.id == user_id && u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
|
|
||||||
//user_data.password = null;
|
|
||||||
user_data.roles.ToList().ForEach(u => u.users = null);
|
user_data.roles.ToList().ForEach(u => u.users = null);
|
||||||
return user_data;
|
return user_data;
|
||||||
}
|
}
|
||||||
@@ -134,8 +132,6 @@ namespace Yi.Framework.Service
|
|||||||
{
|
{
|
||||||
var user_data = await _Db.Set<user>().Include(u => u.roles)
|
var user_data = await _Db.Set<user>().Include(u => u.roles)
|
||||||
.Where(u => u.id == user_id && u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
|
.Where(u => u.id == user_id && u.is_delete == (short)Common.Enum.DelFlagEnum.Normal).FirstOrDefaultAsync();
|
||||||
|
|
||||||
user_data.roles.ToList().ForEach(u => u.users = null);
|
|
||||||
return user_data;
|
return user_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
Yi.Vue/src/util/getMould.js
Normal file
45
Yi.Vue/src/util/getMould.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
function getUrl(menuList, menuStr) {
|
||||||
|
for (var i = 0; i < menuList.length; i++) {
|
||||||
|
if (menuList[i].menu_name == menuStr) {
|
||||||
|
console.log(handUrl(menuList[i]))
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
if (menuList[i].children != undefined) {
|
||||||
|
getUrl(menuList[i].children, menuStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function handUrl(menu) {
|
||||||
|
var axiosUrls = {
|
||||||
|
get: "123",
|
||||||
|
update: "123",
|
||||||
|
del: "123",
|
||||||
|
add: "123",
|
||||||
|
};
|
||||||
|
const myMenu = menu.children;
|
||||||
|
myMenu.forEach(item => {
|
||||||
|
const myName = item.mould.mould_name;
|
||||||
|
const myUrl = item.mould.url;
|
||||||
|
|
||||||
|
switch (myName) {
|
||||||
|
case 'get':
|
||||||
|
axiosUrls.get = myUrl;
|
||||||
|
break;
|
||||||
|
case 'update':
|
||||||
|
axiosUrls.update = myUrl;
|
||||||
|
break;
|
||||||
|
case 'del':
|
||||||
|
axiosUrls.del = myUrl;
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
axiosUrls.add = myUrl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return axiosUrls;
|
||||||
|
}
|
||||||
|
export default { getUrl }
|
||||||
@@ -12,7 +12,92 @@
|
|||||||
</material-card>
|
</material-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import getUrl from '../util/getMould'
|
||||||
export default {
|
export default {
|
||||||
|
created(){
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
init(){
|
||||||
|
const resp= [
|
||||||
|
{
|
||||||
|
menu_name: "首页",
|
||||||
|
icon: "mdi-view-dashboard",
|
||||||
|
to: "/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "用户角色管理",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
menu_name: "用户管理",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admuser/",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
menu_name: "get",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admrole/",
|
||||||
|
mould:{
|
||||||
|
mould_name:"get",
|
||||||
|
url: "666666无敌",
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "角色管理",
|
||||||
|
icon: "mdi-account-tie",
|
||||||
|
to: "/admrole/",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "菜单接口管理",
|
||||||
|
icon: "mdi-clipboard-outline",
|
||||||
|
to: "",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
menu_name: "菜单管理",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admMenu/",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "接口管理",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admMould/",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "角色菜单分配管理",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/admRoleMenu/",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
menu_name: "测试路由",
|
||||||
|
icon: "mdi-clipboard-outline",
|
||||||
|
to: "",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
menu_name: "用户信息",
|
||||||
|
icon: "mdi-account",
|
||||||
|
to: "/userinfo/",
|
||||||
|
children: [],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
var mytest= getUrl.getUrl(resp,"用户管理")
|
||||||
|
console.log(mytest);
|
||||||
|
}
|
||||||
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
axiosUrls: {
|
axiosUrls: {
|
||||||
get: "role/getrole",
|
get: "role/getrole",
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
|
this.newPassword="";
|
||||||
userApi.GetUserInfoById().then((resp) => {
|
userApi.GetUserInfoById().then((resp) => {
|
||||||
this.userInfo = resp.data;
|
this.userInfo = resp.data;
|
||||||
this.userInfo.password="";
|
this.userInfo.password="";
|
||||||
|
|||||||
Reference in New Issue
Block a user