Commit 4177051f authored by shiyu's avatar shiyu

开关设置

parent b10f9e8e
......@@ -8,6 +8,7 @@ package com.wwdz.ch.core.consts;
public enum ResultCode {
SUCCESS(0, "成功"),
UNLOGIN(401, "未登录"),
FAILED(4000, "操作失败"),
UNKNOWN_USER(4001, "请先登录"),
INVALID_FILE(4002, "文件类型不正确"),
......
package com.wwdz.ch.wx.impl.distribution;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
......@@ -22,6 +23,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -158,7 +160,11 @@ public class SupplierItemServiceImpl implements SupplierItemService {
List<SupplierItemVo> supplierItemVos = new ArrayList<>();
//为了小程序过审,关闭列表展示,0关闭,1打开,展示一个默认
Switch sswitch = switchDao.find();
//当前用户
Long userId = dto.getUserId();
if (sswitch.getState() == 0) {
//开关关闭状态,检查是否有用户id,有的话检查是否有浏览记录
if (ObjectUtils.isEmpty(userId)) {
SupplierItem supplierItem = supplierItemDao.findById(3289012L);
SupplierItemVo supplierItemVo = new SupplierItemVo();
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
......@@ -173,8 +179,12 @@ public class SupplierItemServiceImpl implements SupplierItemService {
pageSearchResult.setDataList(supplierItemVos);
return Result.success(pageSearchResult);
}
//当前用户
long userId = dto.getUserId();
}
if (sswitch.getState() == 1) {
if (ObjectUtils.isEmpty(userId)) {
return Result.failed(ResultCode.UNLOGIN);
}
}
//用户默认展示逍遥分享的商品列表
long sellerId = 291997;
//查询用户是否绑定过分销商,绑定过则展示该分销商的商品
......
......@@ -29,7 +29,7 @@ public class UserTokenManager {
private static final String TOKEN_ID_PREFIX = "cjxc:wx:token:token_id_prefix:";
private static Map<String, UserToken> tokenMap = new HashMap<>();
private static Map<Long, UserToken> idMap = new HashMap<>();
private static long SURVIVAL_TIME = 86400;
private static long SURVIVAL_TIME = 86400*7;
public Long getUserId(String token) {
String key = TOKEN_PREFIX + token;
......@@ -88,7 +88,7 @@ public class UserTokenManager {
}
LocalDateTime update = LocalDateTime.now();
LocalDateTime expire = update.plusDays(1);
LocalDateTime expire = update.plusDays(7);
userToken = new UserToken();
userToken.setToken(token);
......
......@@ -43,12 +43,12 @@ public class WxPayServiceTest {
@Test
public void refund() {
List<String> list = Arrays.asList("DA2402061728218723255");
List<String> list = Arrays.asList("DA2402241542377839584");
list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId);
dto.setAmount("0.11");
dto.setRefundPrice("0.11");
dto.setAmount("28.8");
dto.setRefundPrice("28.8");
Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result);
});
......
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