diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java index ada1443..0f02095 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/LoginService.java @@ -65,6 +65,17 @@ public class LoginService { } public void addShopId(String openId, String shopId, Integer type, String nickName, String avatar) { + TbUserShopMsg shopMsg = tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId), openId); + if (Objects.isNull(shopMsg)) { + shopMsg = new TbUserShopMsg(); + shopMsg.setShopId(Integer.valueOf(shopId)); + shopMsg.setOpenId(openId); + shopMsg.setCreateTime(new Date()); + shopMsg.setStatus("1"); + tbUserShopMsgMapper.insert(shopMsg); + } + + // 为商家绑定openid TbShopOpenId tbShopOpenId = shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId), type); if (tbShopOpenId == null) {