Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
data-center-auto
Commits
8beec454
Commit
8beec454
authored
May 07, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增权限管理
parent
918d93ef
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
180 additions
and
56 deletions
+180
-56
TokenResult.cs
AutoTurnOver.Models/TokenResult.cs
+49
-0
UserData.cs
AutoTurnOver.Models/UserData.cs
+5
-0
AutoUtility.cs
AutoTurnOver/Common/AutoUtility.cs
+0
-27
ConfigController.cs
AutoTurnOver/Controllers/ConfigController.cs
+17
-0
DailyController.cs
AutoTurnOver/Controllers/DailyController.cs
+5
-1
ExceptionReminderController.cs
AutoTurnOver/Controllers/ExceptionReminderController.cs
+1
-0
JitTagController.cs
AutoTurnOver/Controllers/JitTagController.cs
+3
-0
NotStockController.cs
AutoTurnOver/Controllers/NotStockController.cs
+1
-0
PurchaseAdviseController.cs
AutoTurnOver/Controllers/PurchaseAdviseController.cs
+1
-0
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+6
-0
SkuAutoTurnController.cs
AutoTurnOver/Controllers/SkuAutoTurnController.cs
+5
-0
UserFilterAttribute.cs
AutoTurnOver/Models/UserFilterAttribute.cs
+80
-0
Startup.cs
AutoTurnOver/Startup.cs
+1
-25
appsettings.Development.json
AutoTurnOver/appsettings.Development.json
+2
-1
appsettings.Production.json
AutoTurnOver/appsettings.Production.json
+2
-1
appsettings.json
AutoTurnOver/appsettings.json
+2
-1
No files found.
AutoTurnOver.Models/TokenResult.cs
View file @
8beec454
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
AutoTurnOver.Models
...
...
@@ -34,6 +35,54 @@ namespace AutoTurnOver.Models
public
CompanyInfo
Company
{
get
;
set
;
}
//public DepartmentInfo Department { get; set; }
public
bool
has_admin
{
get
;
set
;
}
public
List
<
saas_menu_info_dto
>
menuInfoDtos
{
get
;
set
;
}
}
public
class
saas_result_dto
<
T
>
{
public
T
result
{
get
;
set
;
}
public
int
statusCode
{
get
;
set
;
}
public
string
message
{
get
;
set
;
}
}
public
class
Saas_MenusDto
{
public
List
<
saas_menu_info_dto
>
menuInfoDtos
{
get
;
set
;
}
public
bool
success
{
get
;
set
;
}
public
string
projectCode
{
get
;
set
;
}
}
public
class
saas_menu_info_dto
{
public
string
menuCode
{
get
;
set
;
}
public
string
menuName
{
get
;
set
;
}
public
string
menuUrl
{
get
;
set
;
}
private
List
<
string
>
_menuUrl_list
;
public
List
<
string
>
menuUrl_list
{
get
{
if
(
_menuUrl_list
==
null
)
{
if
(
menuUrl
!=
null
)
{
_menuUrl_list
=
menuUrl
.
Split
(
'|'
).
ToList
();
}
}
return
_menuUrl_list
;
}
}
public
string
menuIco
{
get
;
set
;
}
public
string
menuFatherCode
{
get
;
set
;
}
public
int
mMenuLevel
{
get
;
set
;
}
public
bool
?
isshow
{
get
;
set
;
}
}
public
class
tokenRole
{
...
...
AutoTurnOver.Models/UserData.cs
View file @
8beec454
...
...
@@ -58,6 +58,7 @@ namespace AutoTurnOver.Models
/// </summary>
public
string
UserName
{
get
;
set
;
}
#
endregion
}
...
...
@@ -66,5 +67,9 @@ namespace AutoTurnOver.Models
public
string
message
{
get
;
set
;
}
public
int
code
{
get
;
set
;
}
public
UserData
data
{
get
;
set
;
}
public
List
<
saas_menu_info_dto
>
menuInfoDtos
{
get
;
set
;
}
}
}
AutoTurnOver/Common/AutoUtility.cs
View file @
8beec454
...
...
@@ -29,33 +29,6 @@ namespace AutoTurnOver.Common
DepartmentName
=
""
//saasUser.Department==null?"":saasUser.Department.Name
};
//Microsoft.AspNetCore.Http.HttpContext current = HttpContext.Current;
//try
//{
// string cookie;
// current.Request.Cookies.TryGetValue("BLUserAcct",out cookie);
// var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json");
// var configurationRoot = builder.Build();
// string url = ConfigHelper.GetValue("WebHost_GetUser");
// // string url = ConfigurationManager.AppSettings["WebHost"].ToString();
// string userstr = HttpHelper.Request(url, RequestType.POST, "BLUserAcct=" + cookie);
// LoginData data = JsonConvert.DeserializeObject<LoginData>(userstr);
// if (data.code != 1)
// {
// current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
// return null;
// }
// else
// {
// return data.data;
// }
//}
//catch(Exception)
//{
// current.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
// return null;
//}
}
/// <summary>
...
...
AutoTurnOver/Controllers/ConfigController.cs
View file @
8beec454
...
...
@@ -29,6 +29,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
InventoryList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -56,6 +57,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveInventory
([
FromBody
]
dc_auto_config_safe_inventory
m
)
{
var
result
=
new
Services
.
ConfigServices
().
SaveInventory
(
m
,
""
);
...
...
@@ -92,6 +94,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
SalesUpperLimitList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -119,6 +122,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveSalesUpperLimit
([
FromBody
]
dc_auto_config_sales_upper_limit
m
)
{
var
result
=
new
Services
.
ConfigServices
().
SaveSalesUpperLimit
(
m
,
""
);
...
...
@@ -155,6 +159,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
ConfigDeliveryList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -218,6 +223,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
StockUpList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -245,6 +251,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveStockUp
([
FromBody
]
dc_auto_config_stock_up_days
m
)
{
var
result
=
new
Services
.
ConfigServices
().
SaveStockUp
(
m
,
""
);
...
...
@@ -285,6 +292,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
BatchMonitorStatus
(
string
ids
,
int
monitor_status
)
{
var
user
=
AutoUtility
.
GetUser
();
...
...
@@ -308,6 +316,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
StockFbaList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
bailun_sku
,
string
platform_sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -330,6 +339,7 @@ namespace AutoTurnOver.Controllers
});
}
[
UseAction
]
public
JsonResult
StockFbaLoseList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
platform_sku
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -353,6 +363,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveStockFba
([
FromBody
]
dc_base_stock_config_fba
m
)
{
try
...
...
@@ -407,6 +418,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
SalesConfigList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
platform_type
,
string
web_site
,
DateTime
?
start_date
,
DateTime
?
end_date
)
{
var
m
=
new
dc_auto_sales_config_search_dto
...
...
@@ -433,6 +445,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveSalesConfig
([
FromBody
]
dc_auto_sales_config
m
)
{
var
result
=
new
Services
.
ConfigServices
().
SaveSalesConfig
(
m
,
""
);
...
...
@@ -458,6 +471,7 @@ namespace AutoTurnOver.Controllers
#
region
fba
共享仓发货仓
[
HttpGet
]
[
UseAction
]
public
JsonResult
StockUpRangeList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
bailun_sku
,
string
platform_sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -481,6 +495,7 @@ namespace AutoTurnOver.Controllers
}
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveStockUpRange
([
FromBody
]
dc_auto_stock_up_range
m
)
{
try
...
...
@@ -508,6 +523,7 @@ namespace AutoTurnOver.Controllers
#
region
动态备货规则分组
[
HttpGet
]
[
UseAction
]
public
JsonResult
JitTagGroupList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
bailun_sku
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -527,6 +543,7 @@ namespace AutoTurnOver.Controllers
}
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveJitTagGroup
([
FromBody
]
dc_auto_jit_tag_group
m
)
{
try
...
...
AutoTurnOver/Controllers/DailyController.cs
View file @
8beec454
...
...
@@ -52,7 +52,7 @@ namespace AutoTurnOver.Controllers
});
}
/// <summary>
/// 实时库存
...
...
@@ -62,6 +62,7 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
[
UseAction
]
public
JsonResult
RealtimeList
(
int
?
monitor_status
,
int
?
searchType
,
string
key_words
,
string
warehousecode
,
string
buyer_name
,
string
supplier_name
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
,
int
?
has_tort
=
null
,
string
categoryIds
=
null
)
{
...
...
@@ -128,6 +129,7 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
[
UseAction
]
public
FileResult
ExportRealtime
(
int
?
monitor_status
,
int
?
searchType
,
string
key_words
,
string
warehousecode
,
string
buyer_name
,
string
supplier_name
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
,
int
?
has_tort
=
null
,
string
categoryIds
=
null
)
{
var
user
=
AutoUtility
.
GetUser
();
...
...
@@ -160,6 +162,7 @@ namespace AutoTurnOver.Controllers
/// 库存监控
/// </summary>
/// <returns></returns>
[
UseAction
]
public
JsonResult
StockMonitorList
(
int
?
type
,
string
bailun_sku
,
int
offset
,
int
limit
,
string
order
,
string
sort
)
{
...
...
@@ -192,6 +195,7 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
[
UseAction
]
public
FileResult
ExportStockMonitor
(
int
?
type
,
string
bailun_sku
)
{
var
user
=
AutoUtility
.
GetUser
();
...
...
AutoTurnOver/Controllers/ExceptionReminderController.cs
View file @
8beec454
...
...
@@ -16,6 +16,7 @@ namespace AutoTurnOver.Controllers
public
class
ExceptionReminderController
:
ControllerBase
{
[
HttpGet
]
[
UseAction
]
public
JsonResult
List
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
has_overdue
=
null
,
bool
?
has_confirm
=
null
,
bool
?
has_solve
=
null
,
int
?
err_type
=
null
)
{
...
...
AutoTurnOver/Controllers/JitTagController.cs
View file @
8beec454
...
...
@@ -15,6 +15,7 @@ namespace AutoTurnOver.Controllers
#
region
安全库存规则
[
HttpGet
]
[
UseAction
]
public
JsonResult
JitTagList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
int
?
group_id
=
null
)
{
var
total
=
0
;
...
...
@@ -28,6 +29,7 @@ namespace AutoTurnOver.Controllers
});
}
[
UseAction
]
public
JsonResult
JitTagLogList
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
bailun_sku
,
DateTime
?
b_date
,
DateTime
?
e_date
,
int
?
tag_id
=
null
)
{
var
total
=
0
;
...
...
@@ -55,6 +57,7 @@ namespace AutoTurnOver.Controllers
[
HttpPost
]
[
UseAction
]
public
JsonResult
SaveJitTag
([
FromBody
]
dc_auto_jit_tag
m
)
{
var
result
=
new
Services
.
JitTagServices
().
SaveJitTag
(
m
,
""
);
...
...
AutoTurnOver/Controllers/NotStockController.cs
View file @
8beec454
...
...
@@ -13,6 +13,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
[
Route
(
"api/[controller]/[action]"
)]
[
ApiController
]
[
UseAction
]
public
class
NotStockController
:
Controller
{
[
HttpGet
]
...
...
AutoTurnOver/Controllers/PurchaseAdviseController.cs
View file @
8beec454
...
...
@@ -28,6 +28,7 @@ namespace AutoTurnOver.Controllers
/// <param name="start_date"></param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
List
(
int
limit
,
int
offset
,
bool
?
has_push
,
string
sort
,
DateTime
?
end_date
,
DateTime
?
start_date
,
bool
?
is_outofstock
)
{
var
m
=
new
dc_auto_purchase_advise_search_dto
...
...
AutoTurnOver/Controllers/ReportsController.cs
View file @
8beec454
...
...
@@ -111,6 +111,7 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
[
UseAction
]
public
JsonResult
QuantityOutStockList
(
string
bailun_sku
,
string
warehousecode
,
string
product_inner_code
,
string
purchase_user
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
quantity_out_stock_search_dto
...
...
@@ -159,6 +160,7 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
[
UseAction
]
public
FileResult
QuantityOutStockExport
(
string
bailun_sku
,
string
warehousecode
,
string
product_inner_code
,
string
purchase_user
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
quantity_out_stock_search_dto
...
...
@@ -221,6 +223,7 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
[
UseAction
]
public
JsonResult
QuantityOutStockDetailList
(
DateTime
?
pay_time_min
,
DateTime
?
pay_time_max
,
string
platform_type
,
string
shiplogistics_code
,
int
?
bailun_account_id
,
int
?
search_type
,
string
warehousecode
,
string
key_words
,
string
purchase_user
,
int
offset
,
int
limit
,
string
order
,
string
sort
,
string
warehousetype
,
int
?
warehousearea
)
{
var
m
=
new
quantity_out_stock_detail_search_dto
...
...
@@ -621,6 +624,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <param name="platform_type"></param>
/// <returns></returns>
[
UseAction
]
public
JsonResult
GetSkuWebsiteSales
(
string
platform_type
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
...
...
@@ -663,6 +667,7 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
dc_base_stock_dto
()
:
list
[
0
]);
}
[
UseAction
]
public
JsonResult
SupplierSalesList
(
string
supplier_name
,
int
offset
,
int
limit
,
string
order
,
string
sort
)
{
var
m
=
new
supplier_sales_search_dto
...
...
@@ -695,6 +700,7 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
list
==
null
||
list
.
Count
<=
0
?
new
supplier_sales_dto
()
:
list
[
0
]);
}
[
UseAction
]
public
JsonResult
GetGoods
(
string
product_inner_code
,
string
platform_type
,
int
offset
,
int
limit
,
string
order
,
string
sort
)
{
var
m
=
new
bailun_sku_goods_search_dto
...
...
AutoTurnOver/Controllers/SkuAutoTurnController.cs
View file @
8beec454
...
...
@@ -28,6 +28,7 @@ namespace AutoTurnOver.Controllers
/// <param name="pagesize">每页记录数</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
List
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
int
?
searchType
,
string
key_words
,
string
buyer_name
,
int
?
IsRedundant
,
int
?
IsStockOut
,
string
warehousecode
,
string
supplier_name
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
hasDefectConfig
,
bool
?
hasAadvise
=
null
,
string
categoryIds
=
null
,
int
?
monitor_status
=
null
,
int
?
has_tort
=
null
)
{
try
...
...
@@ -109,6 +110,7 @@ namespace AutoTurnOver.Controllers
/// <param name="sku"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
[
UseAction
]
public
ActionResult
Export
(
string
supplier_name
,
int
limit
,
int
offset
,
string
order
,
string
sort
,
int
?
searchType
,
string
key_words
,
string
buyer_name
,
string
sku_prefix
,
int
?
IsRedundant
,
int
?
IsStockOut
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
hasDefectConfig
,
bool
?
hasAadvise
=
null
,
string
categoryIds
=
null
,
int
?
monitor_status
=
null
,
int
?
has_tort
=
null
)
{
try
...
...
@@ -157,6 +159,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
ListSaleSetting
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -316,6 +319,7 @@ namespace AutoTurnOver.Controllers
/// <param name="IsEffective">是否有效数据</param>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
ListCorrection
(
int
limit
,
int
offset
,
string
order
,
string
sort
,
string
sku
,
string
warehousecode
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
IsEffective
=
null
)
{
var
m
=
new
Condition_ConfigPromotion
...
...
@@ -353,6 +357,7 @@ namespace AutoTurnOver.Controllers
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
UseAction
]
public
JsonResult
SaveCorrection
(
int
id
,
string
sku
,
string
warehousecode
,
DateTime
btime
,
DateTime
etime
,
decimal
param
,
string
note
,
string
username
)
{
var
m
=
new
Models
.
dc_auto_config_correction
...
...
AutoTurnOver/Models/UserFilterAttribute.cs
View file @
8beec454
...
...
@@ -14,6 +14,13 @@ namespace AutoTurnOver.Models
{
}
/// <summary>
/// 操作权限
/// </summary>
public
class
UseActionAttribute
:
Attribute
{
}
public
class
UserFilterAttribute
:
ActionFilterAttribute
{
...
...
@@ -49,6 +56,7 @@ namespace AutoTurnOver.Models
{
var
getTokenValid
=
ConfigHelper
.
GetValue
(
"Saas_GetTokenValid"
).
ToString
();
var
getUser
=
ConfigHelper
.
GetValue
(
"Saas_GetUser"
).
ToString
();
var
getMenus
=
ConfigHelper
.
GetValue
(
"Saas_GetMenus"
).
ToString
();
var
httpHelper
=
new
HHttpHelper
();
httpHelper
.
AddHeaderValue
(
"Authorization"
,
token
);
...
...
@@ -62,8 +70,80 @@ namespace AutoTurnOver.Models
string
userStr
=
httpHelper
.
Request
(
getUser
,
HHttpHelper
.
RequestType
.
GET
);
tokenUser
user_info
=
userStr
.
ToObj
<
tokenUser
>();
user_info
.
result
.
has_admin
=
false
;
var
menusStr
=
httpHelper
.
Request
(
getMenus
+
"?ProjectCode=BaiLun_Aims"
,
HHttpHelper
.
RequestType
.
GET
);
var
saas_menus
=
menusStr
.
ToObj
<
saas_result_dto
<
Saas_MenusDto
>>();
if
(
saas_menus
==
null
)
{
throw
new
Exception
(
"saas系统异常:权限获取失败"
);
}
else
{
if
(
saas_menus
.
statusCode
!=
200
)
{
throw
new
Exception
(
saas_menus
.
message
);
}
else
{
if
(
saas_menus
.
result
==
null
)
{
throw
new
Exception
(
"saas系统异常:权限获取失败"
);
}
else
{
if
(!
saas_menus
.
result
.
success
)
{
throw
new
Exception
(
"saas系统异常:权限获取失败"
);
}
else
{
user_info
.
result
.
menuInfoDtos
=
saas_menus
.
result
.
menuInfoDtos
;
}
}
}
}
context
.
Session
.
SetString
(
"UserInfo"
,
user_info
.
result
.
ToJson
());
}
else
{
#
region
效验操作权限
var
isAciton
=
false
;
if
(
controllerActionDescriptor
!=
null
)
{
// 判断控制器或者acion 是否需要验证
isAciton
=
controllerActionDescriptor
.
MethodInfo
.
GetCustomAttributes
(
inherit
:
true
)
.
Any
(
a
=>
a
.
GetType
().
Equals
(
typeof
(
UseActionAttribute
)))
||
controllerActionDescriptor
.
ControllerTypeInfo
.
GetCustomAttributes
(
inherit
:
true
)
.
Any
(
a
=>
a
.
GetType
().
Equals
(
typeof
(
UseActionAttribute
)))
;
//需要验证
if
(
isAciton
)
{
SaasUserInfo
userInfoData
=
userInfo
.
ToObj
<
SaasUserInfo
>();
if
(!
userInfoData
.
menuInfoDtos
.
Any
(
s
=>
s
.
menuUrl_list
.
Any
(
m
=>
(
"/api/"
+
controllerActionDescriptor
.
ControllerTypeInfo
.
Name
+
"/"
+
controllerActionDescriptor
.
MethodInfo
.
Name
).
Equals
(
m
,
StringComparison
.
OrdinalIgnoreCase
))
))
{
context
.
Response
.
StatusCode
=
401
;
filterContext
.
Result
=
new
ContentResult
{
Content
=
"无该功能的操作权限"
,
StatusCode
=
StatusCodes
.
Status401Unauthorized
,
ContentType
=
"text/html;charset=utf-8"
};
}
}
}
else
{
throw
new
Exception
(
"程序异常"
);
}
#
endregion
}
return
;
}
else
...
...
AutoTurnOver/Startup.cs
View file @
8beec454
...
...
@@ -61,34 +61,10 @@ namespace AutoTurnOver
app
.
UseHsts
();
}
app
.
UseDeveloperExceptionPage
();
//app.UseHttpsRedirection();
app
.
UseStaticFiles
();
app
.
UseFileServer
(
new
FileServerOptions
()
//直接开启文件目录访问和文件访问
{
EnableDirectoryBrowsing
=
true
//开启目录访
});
// 跨域配置
//app.UseCors(builder =>
//builder.WithOrigins("http://aims.bailuntec.com")
//.AllowAnyMethod()
//.AllowAnyHeader()
//.AllowCredentials()
//);
MyHttpContext
.
Configure
(
app
.
ApplicationServices
.
GetRequiredService
<
Microsoft
.
AspNetCore
.
Http
.
IHttpContextAccessor
>());
app
.
UseSession
();
app
.
UseMiddleware
<
CorsMiddleware
>();
app
.
UseMvc
(
routes
=>
{
routes
.
MapRoute
(
name
:
"AutoTurn"
,
template
:
"{area:exists}/{controller=Home}/{action=Index}/{id?}"
);
});
// Shows UseCors with CorsPolicyBuilder.
//app.UseCors("AllowSpecificOrigin");
app
.
UseStaticHttpContext
();
app
.
UseMvc
();
}
}
}
AutoTurnOver/appsettings.Development.json
View file @
8beec454
...
...
@@ -39,5 +39,6 @@
"Saas_GetTokenValid"
:
"http://sso.bailuntec.com/GetTokenValidation"
,
"Saas_GetUser"
:
"http://sso.bailuntec.com/GetUserResource"
,
"Saas_Users"
:
"http://sso.bailuntec.com/GetUserByCompany"
,
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
,
"Saas_GetMenus"
:
"http://sso.bailuntec.com/GetMenus"
}
AutoTurnOver/appsettings.Production.json
View file @
8beec454
...
...
@@ -39,5 +39,6 @@
"Saas_GetTokenValid"
:
"http://sso.bailuntec.com/GetTokenValidation"
,
"Saas_GetUser"
:
"http://sso.bailuntec.com/GetUserResource"
,
"Saas_Users"
:
"http://sso.bailuntec.com/GetUserByCompany"
,
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
,
"Saas_GetMenus"
:
"http://sso.bailuntec.com/GetMenus"
}
AutoTurnOver/appsettings.json
View file @
8beec454
...
...
@@ -39,5 +39,6 @@
"Saas_GetTokenValid"
:
"http://sso.bailuntec.com/GetTokenValidation"
,
"Saas_GetUser"
:
"http://sso.bailuntec.com/GetUserResource"
,
"Saas_Users"
:
"http://sso.bailuntec.com/GetUserByCompany"
,
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
"Saas_Departments"
:
"http://sso.bailuntec.com/GetDepartmentsByCompanyId"
,
"Saas_GetMenus"
:
"http://sso.bailuntec.com/GetMenus"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment