diff --git a/mall-account/src/main/java/com/suisung/mall/account/controller/LoginController.java b/mall-account/src/main/java/com/suisung/mall/account/controller/LoginController.java index fd429e25..c81ab6e3 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/controller/LoginController.java +++ b/mall-account/src/main/java/com/suisung/mall/account/controller/LoginController.java @@ -257,8 +257,9 @@ public class LoginController extends BaseControllerImpl { String osType = paramJSON.getStr("os_type"); // 用户类型:0-普通买家; 1-管理员;2-入驻商家;3-代理商; Integer userType = paramJSON.getInt("user_type"); + String inviteCode = paramJSON.getStr("invite_code", ""); - return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, userType, cid, osType); + return accountUserBaseService.doMerchSmsRegisterAndLogin(userMobile, randKey, verifyCode, userType, cid, osType, inviteCode); } @ApiOperation(value = "微信用户一键登录与注册") @@ -294,7 +295,9 @@ public class LoginController extends BaseControllerImpl { paramJSON.getStr("rand_key"), paramJSON.getStr("verify_code"), paramJSON.getInt("user_type"), - paramJSON.getStr("cid"), paramJSON.getStr("os_type")); + paramJSON.getStr("cid"), + paramJSON.getStr("os_type"), + paramJSON.getStr("invite_code")); } @ApiOperation("退出登录") diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java index efbf0a85..0b9a4893 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBaseService.java @@ -145,9 +145,10 @@ public interface AccountUserBaseService extends IBaseService { * @param userType 用户类型:0-普通买家; 1-管理员;2-入驻商家;3-代理商; * @param cid 推送 cid * @param osType 手机系统类型 :1-Android;2-iOS;3-微信小程序; + * @param inviteCode 代理商邀请码 * @return */ - CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, Integer userType, String cid, String osType); + CommonResult doMerchSmsRegisterAndLogin(String user_mobile, String rand_key, String verify_code, Integer userType, String cid, String osType, String inviteCode); /** * 微信小程序一键登录注册接口 diff --git a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBindConnectService.java b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBindConnectService.java index 81d35e0b..910231dc 100644 --- a/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBindConnectService.java +++ b/mall-account/src/main/java/com/suisung/mall/account/service/AccountUserBindConnectService.java @@ -87,9 +87,10 @@ public interface AccountUserBindConnectService extends IBaseService getAllBindPage(String bindTmpl, Integer pageNum, Integer pageSize); @@ -105,7 +106,7 @@ public interface AccountUserBindConnectService extends IBaseService0){ - if(storeId>0){ //店铺推送订阅 - ShopStoreMember params=new ShopStoreMember(); + if (integer != null && integer > 0) { + if (storeId > 0) { //店铺推送订阅 + ShopStoreMember params = new ShopStoreMember(); params.setUserId(userId); params.setStoreId(storeId); - List shopStoreMemberList=shopService.findShopStoreMemberList(params); - if(shopStoreMemberList!=null&& !shopStoreMemberList.isEmpty()){ - ShopStoreMember shopStoreMember= shopStoreMemberList.get(0); - shopStoreMember.setSend_number(shopStoreMember.getSend_number()+1); - ShopStoreMember resultShopStoreMember = shopService.saveShopStoreMember(shopStoreMember); - if(resultShopStoreMember.getStore_member_id()!=null){ - redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE,mapKey, -1);//店铺扣除一次 + List shopStoreMemberList = shopService.findShopStoreMemberList(params); + if (shopStoreMemberList != null && !shopStoreMemberList.isEmpty()) { + ShopStoreMember shopStoreMember = shopStoreMemberList.get(0); + shopStoreMember.setSend_number(shopStoreMember.getSend_number() + 1); + ShopStoreMember resultShopStoreMember = shopService.saveShopStoreMember(shopStoreMember); + if (resultShopStoreMember.getStore_member_id() != null) { + redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, -1);//店铺扣除一次 } } - }else {//平台推送订阅 + } else {//平台推送订阅 QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("bind_id", "+86"+mobile)//+86的 + queryWrapper.eq("bind_id", "+86" + mobile)//+86的 .eq("bind_type", BindCode.MOBILE) .eq("user_type", 0) .eq("user_id", userId) .eq("bind_active", CommonConstant.Enable) .orderByAsc("bind_time"); List accountUserBindConnectList = list(queryWrapper); - AccountUserBindConnect accountUserBindConnect= accountUserBindConnectList.get(0); - if (accountUserBindConnectList.isEmpty()){ + AccountUserBindConnect accountUserBindConnect = accountUserBindConnectList.get(0); + if (accountUserBindConnectList.isEmpty()) { return; } UpdateWrapper updateWrapper = new UpdateWrapper<>(); - accountUserBindConnect.setSend_number(accountUserBindConnect.getSend_number()+1); + accountUserBindConnect.setSend_number(accountUserBindConnect.getSend_number() + 1); getUpdateWrapper(updateWrapper, accountUserBindConnect); - if(update(updateWrapper)){ - redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE,mapKey, -1);//店铺扣除一次 + if (update(updateWrapper)) { + redisTemplate.opsForHash().increment(RedisConstant.SUB_SEND_CACHE, mapKey, -1);//店铺扣除一次 } } } @@ -496,7 +497,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl updateWrapper= new UpdateWrapper<>(); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); try { for (AccountUserBindConnect accountUserBindConnect : accountUserBindConnectList) { updateWrapper.set("send_number", accountUserBindConnect.getSend_number()); @@ -596,13 +597,14 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl