增加越南获取用户信息接口

jieling
DESKTOP-C3M45P4\dengdan 2025-02-19 13:12:02 +08:00
parent 7416a705a4
commit 5a655ada7d
3 changed files with 104 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package com.jmfy.controller;
import com.alibaba.fastjson.JSONObject;
import com.jmfy.dao.ServerInfoDao;
import com.jmfy.dao.UserInfoDao;
import com.jmfy.dao.impl.GSUserDaoImpl;
@ -9,9 +10,9 @@ import com.jmfy.model.vo.CUserVo;
import com.jmfy.model.vo.Hero;
import com.jmfy.model.vo.UserGodLvVo;
import com.jmfy.redisProperties.RedisUserKey;
import com.jmfy.utils.DateUtil;
import com.jmfy.utils.JsonUtil;
import com.jmfy.utils.RedisUtil;
import com.jmfy.utils.*;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
@ -84,6 +85,78 @@ public class UserInfoController {
return "userInfo";
}
@RequestMapping(value = "/gomotaGetRoleList", method = {RequestMethod.POST, RequestMethod.GET})
public String gomotaGetRoleInfo(ModelMap map, HttpServletRequest request) throws Exception {
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
String appota_user_id = request.getParameter("appota_user_id");
String api_key = request.getParameter("api_key");
String server_id = request.getParameter("server_id");
String signature = request.getParameter("signature");
DBObject resp = new BasicDBObject();
List<JSONObject> roleList = new ArrayList<>();
if (StringUtils.checkIsEmpty(appota_user_id)) {
resp.put("message", "appota_user_id null");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
if (StringUtils.checkIsEmpty(server_id)) {
resp.put("message", "server_id null");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
if (StringUtils.checkIsEmpty(api_key)) {
resp.put("message", "sub_channel null");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
if (StringUtils.checkIsEmpty(signature)) {
resp.put("message", "signature null");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
if(!api_key.equals(GamotaConstats.apikey)){
resp.put("message", "api_key error");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
String signStr = api_key + appota_user_id + server_id;
String sign = MD5Util.encrypByMd5(signStr);
if(!sign.equals(signature)){
LOGGER.info("sign=" + sign + " --- signature="+signature);
resp.put("message", "signature error");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
CUserInfo userInfoById = userInfoDao.findUserInfoByOpenId(server_id,appota_user_id);
int serverId = HeFuManager.getHefuServerId(userInfoById.getServerid());
GSUser gsUser = gsUserDao.findUserInfoQuick(serverId, Integer.parseInt(userInfoById.getId()));
if (gsUser == null) {
LOGGER.info("user null with appota_user_id : " + appota_user_id + " --- server_id : "+server_id);
resp.put("message", "role null");
resp.put("error_code", 1);
resp.put("data", roleList);
return resp.toString();
}
JSONObject obj = new JSONObject();
CUserVo cUserVo = getcUserVo(gsUser);
obj.put("role_name",gsUser.getPlayerManager().getNickName());
obj.put("role_id",gsUser.getId());
roleList.add(obj);
resp.put("message", "success");
resp.put("error_code", 0);
resp.put("data", roleList);
return resp.toString();
}
@RequestMapping(value = "/getHeroInfo", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody

View File

@ -0,0 +1,11 @@
package com.jmfy.utils;
/**
* Gamota
*/
public class GamotaConstats {
public final static String apikey = "GMA202401-4B0C8B6C-C3B7290DEC0B";
public final static String secretKey = "XAhRvf9ycmv6BJGTUJci";
}

View File

@ -0,0 +1,17 @@
package com.jmfy.utils;
public class StringUtils {
public static boolean checkIsEmpty(String source){
if(source == null || "".equals(source))
return true;
return false;
}
public static boolean checkIsNumberOrChar(String source){
return source.matches("[a-zA-Z0-9]+");
}
}