File tree Expand file tree Collapse file tree 4 files changed +59
-1
lines changed
MVVM.Angular.Website/static/src/modules/generated_module/services
MVVM.Common.Base/src/Application
MVVM.Common.Organization/src/Application/Services Expand file tree Collapse file tree 4 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -62,4 +62,12 @@ export class WebsiteManageService {
6262 request
6363 } ) ;
6464 }
65+
66+ /** 获取当前的Api函数信息 */
67+ GetApiMethodInfo ( ) : Observable < string > {
68+ return this . appApiService . call < string > (
69+ "/api/WebsiteManageService/GetApiMethodInfo" ,
70+ {
71+ } ) ;
72+ }
6573}
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Text ;
4+ using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Structs ;
5+ using ZKWebStandard . Extensions ;
6+ using ZKWebStandard . Web ;
7+
8+ namespace ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Extensions
9+ {
10+ /// <summary>
11+ /// Http上下文的扩展函数
12+ /// </summary>
13+ public static class IHttpContextExtensions
14+ {
15+ /// <summary>
16+ /// 设置当前的Api函数信息
17+ /// </summary>
18+ public static void SetApiMethodInfo ( this IHttpContext context , ApplicationServiceApiMethodInfo info )
19+ {
20+ context . Items [ typeof ( ApplicationServiceApiMethodInfo ) ] = info ;
21+ }
22+
23+ /// <summary>
24+ /// 获取当前的Api函数信息
25+ /// </summary>
26+ public static ApplicationServiceApiMethodInfo GetApiMethodInfo ( this IHttpContext context )
27+ {
28+ var info = context . Items . GetOrDefault ( typeof ( ApplicationServiceApiMethodInfo ) ) ;
29+ return ( ApplicationServiceApiMethodInfo ) info ;
30+ }
31+ }
32+ }
Original file line number Diff line number Diff line change 33using System . FastReflection ;
44using System . Linq ;
55using System . Reflection ;
6+ using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Extensions ;
67using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Attributes ;
78using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Interfaces ;
89using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Structs ;
@@ -71,8 +72,16 @@ public virtual IEnumerable<ApplicationServiceApiMethodInfo> GetApiMethods()
7172 {
7273 action = filterAttribute . Filter ( action ) ;
7374 }
75+ // 请求时自动设置当前的Api信息
76+ ApplicationServiceApiMethodInfo info = null ;
77+ var innerAction = action ;
78+ action = ( ) =>
79+ {
80+ Context . SetApiMethodInfo ( info ) ;
81+ return innerAction ( ) ;
82+ } ;
7483 // 返回函数信息
75- var info = new ApplicationServiceApiMethodInfo (
84+ info = new ApplicationServiceApiMethodInfo (
7685 method . ReturnType ,
7786 method . Name ,
7887 $ "{ UrlBase } /{ method . Name } ",
Original file line number Diff line number Diff line change 66using ZKWeb . Cache ;
77using ZKWeb . Localize ;
88using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Dtos ;
9+ using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Extensions ;
910using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Bases ;
11+ using ZKWeb . MVVMPlugins . MVVM . Common . Base . src . Application . Services . Structs ;
1012using ZKWeb . MVVMPlugins . MVVM . Common . Organization . src . Application . Dtos ;
1113using ZKWeb . MVVMPlugins . MVVM . Common . Organization . src . Components . ActionFilters ;
1214using ZKWeb . MVVMPlugins . MVVM . Common . Organization . src . Components . GenericConfigs ;
@@ -113,5 +115,12 @@ public GridSearchResponseDto SearchScheduledTaskLogs(GridSearchRequestDto reques
113115 ( c , q ) => q . Where ( t => t . Task . Id . Contains ( ( string ) c . Value ) ) )
114116 . ToResponse < ScheduledTaskLogOutputDto > ( ) ;
115117 }
118+
119+ [ Description ( "获取当前的Api函数信息" ) ]
120+ public string GetApiMethodInfo ( )
121+ {
122+ var info = Context . GetApiMethodInfo ( ) ;
123+ return info . Name ;
124+ }
116125 }
117126}
You can’t perform that action at this time.
0 commit comments