|
@@ -1,10 +1,7 @@
|
|
|
package com.incubator.game.util;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
public final class GMUtil {
|
|
|
|
|
|
// todo 接口获取后台玩法规则配置,后面改成正式
|
|
@@ -17,11 +14,11 @@ public final class GMUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public static GMStruct.GameRule getRule(int type) {
|
|
|
- Map<String, String> map = JSON.parseObject(json, Map.class);
|
|
|
- if (map == null || map.isEmpty()) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
+ if (jsonObject == null || jsonObject.isEmpty()) {
|
|
|
return null;
|
|
|
}
|
|
|
- String json = map.getOrDefault(String.valueOf(type), "");
|
|
|
+ String json = jsonObject.getString(String.valueOf(type));
|
|
|
if (json.isEmpty()) {
|
|
|
return null;
|
|
|
}
|