Browse Source

unionid 绑卡

master
wangpengfei 1 year ago
parent
commit
97547da023
  1. 14
      src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerService.java
  2. 4
      src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java

14
src/main/java/com/yxt/yythmall/biz/lpkcustomer/LpkCustomerService.java

@ -93,10 +93,10 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
if (!jsonObject.containsKey("openid")) {
return rb.setMsg("未获得openid,请联系管理员");
}
// String unionid = jsonObject.get("unionid").toString();
String unionid = jsonObject.get("unionid").toString();
String openid = jsonObject.get("openid").toString();
Map<String, String> map = new HashMap<>();
// map.put("unionid",unionid);
map.put("unionid",unionid);
map.put("openid", openid);
LpkCustomer lpkCustomer = baseMapper.selectOne(new QueryWrapper<LpkCustomer>().eq("wxMpOpenid", openid));
// List<LpkCustomer> lpkCustomer= baseMapper.getCustomer(openid);
@ -105,7 +105,7 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
//新增用户
LpkCustomer newCustomer = new LpkCustomer();
newCustomer.setWxMpOpenid(openid);
// newCustomer.setUnionId(unionid);
newCustomer.setUnionId(unionid);
newCustomer.setCreateTime(new Date());
newCustomer.setIsPurchase("1");
newCustomer.setIsNewUser("1");
@ -135,10 +135,10 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp
baseMapper.updateById(lpkCustomer);
lpkCustomer = fetchBySid(lpkCustomer.getSid());
}
// if(StringUtils.isBlank(lpkCustomer.getUnionId())){
// lpkCustomer.setUnionId(unionid);
// baseMapper.updateById(lpkCustomer);
// }
if(StringUtils.isBlank(lpkCustomer.getUnionId())){
lpkCustomer.setUnionId(unionid);
baseMapper.updateById(lpkCustomer);
}
StpUtil.login(lpkCustomer.getId());
SaTokenInfo tokenInfo = StpUtil.getTokenInfo();
lpkCustomer.setToken(tokenInfo.getTokenValue());

4
src/main/java/com/yxt/yythmall/biz/lpkgiftcard/LpkGiftCardService.java

@ -169,7 +169,9 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
@Transactional(rollbackFor = Exception.class)
public ResultBean bindAllCard(BindCardDto bindCardDto) {
ResultBean rb = new ResultBean().fail();
if(StringUtils.isBlank(bindCardDto.getCustomerSid())){
return rb.setMsg("参数不全");
}
if (bindCardDto.getCode().substring(0, 2).equals("99")) {
ResultBean rb2 = empCardGiftService.bindCard(bindCardDto);
return rb2;

Loading…
Cancel
Save