整合登录service

master
DESKTOP-C3M45P4\dengdan 2026-03-27 16:42:50 +08:00
parent 632e9f98b0
commit 2c479d4406
20 changed files with 162 additions and 21 deletions

View File

@ -108,6 +108,14 @@ public class GetUserController extends HttpServlet {
serviceMap.put("XY_CHONGPO", new QuickXyChongPoVerifyService("XY_CHONGPO"));
//西游冲破难关长尾
serviceMap.put("XY_CHONGPO_CW", new QuickXyChongPoCwVerifyService("XY_CHONGPO_CW"));
//大臣龙珠
serviceMap.put("LZDC_01", new DcVerifyService("LZDC_01"));
serviceMap.put("LZDC_02", new DcVerifyService("LZDC_02"));
serviceMap.put("LZDC_03", new DcVerifyService("LZDC_03"));
serviceMap.put("LZDC_04", new DcVerifyService("LZDC_04"));
serviceMap.put("LZDC_05", new DcVerifyService("LZDC_05"));
serviceMap.put("LZDC_06", new DcVerifyService("LZDC_06"));
serviceMap.put("LZDC_07", new DcVerifyService("LZDC_07"));
}
@ -203,7 +211,7 @@ public class GetUserController extends HttpServlet {
if (AppConstans.appsecret.equals(admin) || "YX_YSL".equals(channel) || "KT".equals(channel)) {
verify = true;
} else {
verify = serviceMap.get(channel).verify(response, request, admin, platform, pid, openId, token);
verify = serviceMap.get(channel).verify(response, request, admin, platform, pid, openId, token,channel);
}
if(!verify){
returnErrorToFront(res,response,"校验失败,请重新登录");

View File

@ -40,7 +40,8 @@ public abstract class AbstractVerifyService implements VerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了

View File

@ -31,7 +31,8 @@ public class AiWanVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token) {
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin,
String platform, String pid, String openId, String token,String channel) {
try {
//如果是自己人不需要验证了
if (AppConstans.appsecret.equals(admin)) {

View File

@ -28,7 +28,8 @@ public class AnJiuVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -0,0 +1,115 @@
package com.ljsd.service;
import com.ljsd.pojo.VerifyParams;
import com.ljsd.util.AppConstans;
import com.ljsd.util.HttpUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* 1
*/
public class DcVerifyService extends QuickVerifyService{
private static final Logger LOGGER = LoggerFactory.getLogger(DcVerifyService.class);
public final static String product_code = "49127511565758708901212394808832";
public final static String url = "https://checkuser.gamedachen.com/v2/checkUserInfo";
public static Map<String,String> codeMaps = new HashMap<>();
public DcVerifyService(String sign) {
super(sign);
codeMaps.put("LZDC_01","49127511565758708901212394808832");
codeMaps.put("LZDC_02","84003158412685620757582476429808");
codeMaps.put("LZDC_03","28366087022257864308477324713065");
codeMaps.put("LZDC_04","66810437148348044415311945841057");
codeMaps.put("LZDC_05","74924323503285196916023922255923");
codeMaps.put("LZDC_06","24088072086445130441369178648250");
codeMaps.put("LZDC_07","85619891828665981410027878954912");
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {
return true;
}
if (isTestLan == 1) { //test
boolean result = loginVerfifyByTestLan(openId, token);
if (!result) {
response.sendError(400, "verify fail");
LOGGER.error("test verify fail");
return false;
}
} else if (!"3".equals(platform) ) {//正式 切不是pc
String sub_channel = request.getParameter("sub_channel");
boolean result = false;
if (sub_channel != null && !sub_channel.isEmpty()) {
if (sub_channel.equals("1000")) {
//测试服构建参数
VerifyParams params = new VerifyParams();
params.setProductCode(product_code);
VerifyParams testParam = getTestParam(params,request, openId, token);
result = verifyTest(testParam);
}else {
//正式服appId
VerifyParams params = new VerifyParams();
params.setProductCode(product_code);
VerifyParams formatParam = getQuickFormatParam(params,request, openId, token,platform,channel);
result = verifyFormat(formatParam);
}
}
if (!result) {
response.sendError(400, "verify fail");
LOGGER.error("verify fail");
return false;
}
}
}catch (Exception e){
e.printStackTrace();
}
return true;
}
@Override
boolean doVerify(VerifyParams params) {
String channel = params.getChannel();
if(channel == null){
channel = "";
}
String product_code = "";
if(codeMaps.containsKey(channel)){
product_code = codeMaps.get(channel);
}
LOGGER.info("quick 大臣渠道 登录验证-->{}",params.getOpenId() + "-----channel" + channel + "----product_code" + product_code);
Map<String,String> parms = new HashMap<>();
parms.put("token",params.getToken());
parms.put("product_code", product_code);
parms.put("uid",params.getOpenId());
String channel_code = params.getPlatformId();
if(channel_code == null){
channel_code = "";
}
parms.put("channel_code",channel_code);
boolean result = false;
try {
String r = HttpUtils.doPost(url, parms);
LOGGER.info("quick 大臣渠道 请求结果:{}",r + "----channel_code:" + channel_code + "-----channel" + channel);
if (r != null && r.equals("1")) {
result = true;
}
}catch (IOException e){
LOGGER.info("quick 大臣渠道 验证失败,IOException:{}",e.getMessage() + "----channel" + channel);
return false;
}
return result;
}
}

View File

@ -28,7 +28,8 @@ public class Dna01VerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -23,7 +23,8 @@ public class DuoYouVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -21,7 +21,8 @@ public class EightUVerifyService extends AbstractVerifyService {
super(sign);
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin,
String platform, String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -23,7 +23,8 @@ public class FengTiVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -27,7 +27,8 @@ public class HFVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token) {
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin,
String platform, String pid, String openId, String token,String channel) {
try {
if (AppConstans.appsecret.equals(admin)) {
return true;

View File

@ -22,7 +22,8 @@ public class QiYouVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {
return true;

View File

@ -22,7 +22,8 @@ public class QuickVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {
@ -49,7 +50,7 @@ public class QuickVerifyService extends AbstractVerifyService {
//正式服appId
VerifyParams params = new VerifyParams();
params.setProductCode(product_code);
VerifyParams formatParam = getQuickFormatParam(params,request, openId, token,platform);
VerifyParams formatParam = getQuickFormatParam(params,request, openId, token,platform,channel);
result = verifyFormat(formatParam);
}
}
@ -114,11 +115,12 @@ public class QuickVerifyService extends AbstractVerifyService {
return params;
}
protected VerifyParams getQuickFormatParam(VerifyParams params, HttpServletRequest request, String openId, String token,String platform) {
protected VerifyParams getQuickFormatParam(VerifyParams params, HttpServletRequest request, String openId, String token,String platform,String channel) {
params.setChannel("QUICK");
params.setToken(token);
params.setOpenId(openId);
params.setPlatformId(platform);
params.setChannel(channel);
return params;
}
}

View File

@ -22,7 +22,8 @@ public class QuickVerifyService2 extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin,
String platform, String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -34,7 +34,8 @@ public class QuickVerifyService3 extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin,
String platform, String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -27,7 +27,8 @@ public class Tcx027VerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -19,7 +19,8 @@ public class U1GameVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
*/
public interface VerifyService {
boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token);
boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token,String channel);
String getServiceSign();

View File

@ -19,7 +19,8 @@ public class VietnamGamotaVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -23,7 +23,8 @@ public class YouGuTcxVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform,
String pid, String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {

View File

@ -23,7 +23,8 @@ public class YouGuVerifyService extends AbstractVerifyService {
}
@Override
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid, String openId, String token){
public boolean verify(HttpServletResponse response, HttpServletRequest request, String admin, String platform, String pid,
String openId, String token,String channel){
try {
//如果是自己人不需要验证了
if(AppConstans.appsecret.equals(admin)) {