Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
cc396c97
Commit
cc396c97
authored
Jul 23, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
7c3e29a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
api-server/src/main/java/com/zq/api/service/ApiService.java
+3
-3
api-server/src/main/java/com/zq/api/service/impl/BaseApiLogic.java
+3
-1
api-server/src/main/java/com/zq/api/utils/ApiUtils.java
+7
-3
No files found.
api-server/src/main/java/com/zq/api/service/ApiService.java
View file @
cc396c97
...
@@ -25,10 +25,10 @@ public class ApiService {
...
@@ -25,10 +25,10 @@ public class ApiService {
private
final
ApiLogDao
apiLogDao
;
private
final
ApiLogDao
apiLogDao
;
private
static
List
<
String
>
methodList
;
private
static
final
List
<
String
>
METHOD_LIST
;
static
{
static
{
methodList
=
methodList
();
METHOD_LIST
=
methodList
();
}
}
public
IApiLogic
getApiLogic
(
ApiForm
form
)
{
public
IApiLogic
getApiLogic
(
ApiForm
form
)
{
...
@@ -49,7 +49,7 @@ public class ApiService {
...
@@ -49,7 +49,7 @@ public class ApiService {
}
}
public
ApiResp
action
(
ApiForm
form
)
throws
Exception
{
public
ApiResp
action
(
ApiForm
form
)
throws
Exception
{
if
(!
methodList
.
contains
(
form
.
getMethod
()))
{
if
(!
METHOD_LIST
.
contains
(
form
.
getMethod
()))
{
return
ApiUtils
.
getMethodError
(
form
);
return
ApiUtils
.
getMethodError
(
form
);
}
}
// 签名验证标识
// 签名验证标识
...
...
api-server/src/main/java/com/zq/api/service/impl/BaseApiLogic.java
View file @
cc396c97
...
@@ -9,6 +9,8 @@ import com.zq.api.utils.ApiUtils;
...
@@ -9,6 +9,8 @@ import com.zq.api.utils.ApiUtils;
* API基础类
* API基础类
* <p>
* <p>
* 2016年11月15日 下午9:48:27
* 2016年11月15日 下午9:48:27
*
* @author wilmiam
*/
*/
public
abstract
class
BaseApiLogic
implements
IApiLogic
{
public
abstract
class
BaseApiLogic
implements
IApiLogic
{
...
@@ -41,7 +43,7 @@ public abstract class BaseApiLogic implements IApiLogic {
...
@@ -41,7 +43,7 @@ public abstract class BaseApiLogic implements IApiLogic {
* @return
* @return
*/
*/
protected
boolean
notValid
(
ApiForm
form
)
{
protected
boolean
notValid
(
ApiForm
form
)
{
return
form
.
getMethod
().
equals
(
"login"
);
return
"login"
.
equals
(
form
.
getMethod
()
);
}
}
@Override
@Override
...
...
api-server/src/main/java/com/zq/api/utils/ApiUtils.java
View file @
cc396c97
...
@@ -20,10 +20,14 @@ import java.util.HashMap;
...
@@ -20,10 +20,14 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
/**
* @author wilmiam
* @since 2021-07-22 10:18
*/
@Component
@Component
public
class
ApiUtils
{
public
class
ApiUtils
{
private
static
final
Map
<
String
,
IApiLogic
>
map
=
new
HashMap
<>();
private
static
final
Map
<
String
,
IApiLogic
>
MAP
=
new
HashMap
<>();
/**
/**
* 调试日志
* 调试日志
*/
*/
...
@@ -35,11 +39,11 @@ public class ApiUtils {
...
@@ -35,11 +39,11 @@ public class ApiUtils {
}
}
public
static
void
addApi
(
String
version
,
IApiLogic
apiLogic
)
{
public
static
void
addApi
(
String
version
,
IApiLogic
apiLogic
)
{
map
.
put
(
version
,
apiLogic
);
MAP
.
put
(
version
,
apiLogic
);
}
}
public
static
IApiLogic
getApiLogic
(
ApiForm
form
)
{
public
static
IApiLogic
getApiLogic
(
ApiForm
form
)
{
return
map
.
get
(
form
.
getVersion
());
return
MAP
.
get
(
form
.
getVersion
());
}
}
/**
/**
...
...
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