Commit cc396c97 by 袁伟铭

1.0.0

parent 7c3e29a8
...@@ -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);
} }
// 签名验证标识 // 签名验证标识
......
...@@ -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
......
...@@ -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());
} }
/** /**
......
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