fix: 茅台预约商品,修复刷新预约商品bug。
This commit is contained in:
@@ -153,7 +153,7 @@ public class IShopServiceImpl implements IShopService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCurrentSessionId() {
|
public String getCurrentSessionId() {
|
||||||
String mtSessionId = Convert.toStr(redisCache.getCacheObject(IMTCacheConstants.MT_SESSION_ID));
|
String mtSessionId = Convert.toStr(redisCache.getCacheObject(IMTCacheConstants.MT_SESSION_ID));
|
||||||
|
|
||||||
@@ -170,7 +170,24 @@ public class IShopServiceImpl implements IShopService {
|
|||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
mtSessionId = data.getString("sessionId");
|
mtSessionId = data.getString("sessionId");
|
||||||
redisCache.setCacheObject(IMTCacheConstants.MT_SESSION_ID, mtSessionId, 2, TimeUnit.HOURS);
|
redisCache.setCacheObject(IMTCacheConstants.MT_SESSION_ID, mtSessionId, 2, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mtSessionId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refreshItem() {
|
||||||
|
redisCache.deleteObject(IMTCacheConstants.MT_SESSION_ID);
|
||||||
|
long dayTime = LocalDate.now().atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
||||||
|
String res = HttpUtil.get("https://static.moutai519.com.cn/mt-backend/xhr/front/mall/index/session/get/" + dayTime);
|
||||||
|
//替换 current_session_id 673 ['data']['sessionId']
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||||
|
|
||||||
|
if (jsonObject.getString("code").equals("2000")) {
|
||||||
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
|
redisCache.setCacheObject(IMTCacheConstants.MT_SESSION_ID, data.getString("sessionId"), 2, TimeUnit.HOURS);
|
||||||
iItemMapper.truncateItem();
|
iItemMapper.truncateItem();
|
||||||
//item插入数据库
|
//item插入数据库
|
||||||
JSONArray itemList = data.getJSONArray("itemList");
|
JSONArray itemList = data.getJSONArray("itemList");
|
||||||
@@ -182,15 +199,6 @@ public class IShopServiceImpl implements IShopService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mtSessionId;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void refreshItem() {
|
|
||||||
redisCache.deleteObject(IMTCacheConstants.MT_SESSION_ID);
|
|
||||||
getCurrentSessionId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user