Commit 61692897 authored by 曾水平's avatar 曾水平

优化

parent 3c9b2700
......@@ -8,6 +8,7 @@ import cn.com.duiba.jdactivity.common.vo.Result;
import cn.com.duiba.jdactivity.common.vo.ResultBuilder;
import cn.com.duiba.jdactivity.developer.duiba.DuibaAppEnum;
import cn.com.duiba.jdactivity.developer.jd.JdAppEnum;
import cn.com.duiba.jdactivity.developer.jd.JdShopEnum;
import cn.com.duiba.jdactivity.developer.jd.utils.AccessTokenUtils;
import cn.com.duiba.jdactivity.developer.jd.utils.EncryptUtil;
import cn.com.duiba.jdactivity.developer.jd.utils.JdApiUtil;
......@@ -33,6 +34,7 @@ import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -88,9 +90,9 @@ public class Open2DuibaController {
public Result<String> autologin(@RequestBody AutologinParam autologinParam) {
try {
LOGGER.info("autologin,autologinParam={}", JSON.toJSONString(autologinParam));
Long shopId = autologinParam.getShopId();
Long venderId = autologinParam.getVenderId();
JdShopEnum jdShopEnum = JdShopEnum.DUIBA;
Long shopId = Optional.ofNullable(autologinParam.getShopId()).filter(aLong -> aLong != 0L).orElse(jdShopEnum.getShopId());
Long venderId = Optional.ofNullable(autologinParam.getVenderId()).filter(aLong -> aLong != 0L).orElse(jdShopEnum.getVenderId());
String token = autologinParam.getToken();
String source = autologinParam.getSource();
String redirectUrl = autologinParam.getRedirectUrl();
......
package cn.com.duiba.jdactivity.developer.jd;
public enum JdShopEnum {
DUIBA("杭州兑吧", 10139787L, 10276497L),
BOSIDENG("波司登官方旗舰店", 44892L, 48034L);
private final String shopName;
/**
* 店铺Id
*/
private final Long shopId;
/**
* 商家Id
*/
private final Long venderId;
JdShopEnum(String shopName, Long shopId, Long venderId) {
this.shopName = shopName;
this.shopId = shopId;
this.venderId = venderId;
}
public String getShopName() {
return shopName;
}
public Long getShopId() {
return shopId;
}
public Long getVenderId() {
return venderId;
}
}
......@@ -86,7 +86,8 @@
function autoLogin(token) {
let redirect = getUrlParam("redirect");
let env = getUrlParam("env");
console.log("获取env的返回", env);
let shopId = getUrlParam("shopId");
let venderId = getUrlParam("venderId");
$.ajax({
type: 'post',
......@@ -94,6 +95,8 @@
data: JSON.stringify({
token: token,
redirectUrl: redirect,
shopId: shopId,
venderId: venderId,
env: env
}),
async: false,
......
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