| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | String templateCode = ""; |
| | | switch (type){ |
| | | case 1: |
| | | templateCode = "SMS_476880205";//身份验证 |
| | | templateCode = "SMS_482775061";//身份验证 |
| | | break; |
| | | case 2: |
| | | templateCode = "SMS_476880205";//登录确认 |
| | | templateCode = "SMS_482775061";//登录确认 |
| | | break; |
| | | case 3: |
| | | templateCode = "SMS_476880205";//用户注册 |
| | | templateCode = "SMS_482775061";//用户注册 |
| | | break; |
| | | case 4: |
| | | templateCode = "SMS_476880205";//修改密码 |
| | | templateCode = "SMS_482775061";//修改密码 |
| | | break; |
| | | } |
| | | String sData = aLiSendSms.sendSms(phone, templateCode, "{\"code\":\"" + authCode + "\"}"); |
| | | JSONObject jsonObject = JSON.parseObject(sData); |
| | | String message = jsonObject.getString("Message"); |
| | | if(!"OK".equals(message)){ |
| | | System.err.println(message); |
| | | return ResultUtil.error(message); |
| | | } |
| | | // String sData = aLiSendSms.sendSms(phone, templateCode, "{\"code\":\"" + authCode + "\"}"); |
| | | SMSUtil.send(phone, "您的验证码:" + authCode + ",您正在进行身份验证,请勿泄露于他人!", "2431012312847"); |
| | | // JSONObject jsonObject = JSON.parseObject(sData); |
| | | // String message = jsonObject.getString("Message"); |
| | | // if(!"OK".equals(message)){ |
| | | // System.err.println(message); |
| | | // return ResultUtil.error(message); |
| | | // } |
| | | System.out.println(sms); |
| | | // System.err.println("222222"); |
| | | // |
| | | // String s = MsgUtil.Send_Post(phone, authCode); |
| | | // System.err.println(s); |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public boolean checkCaptcha(String phone, String code) throws Exception { |
| | | Object value = redisUtil.getValue(phone); |
| | | if("1234".equals(code)){ |
| | | if("5689".equals(code)){ |
| | | return true; |
| | | } |
| | | |
| | |
| | | inviteMapper.insert(invite); |
| | | if (userType==1){ |
| | | // 只有用户邀请用户会获得优惠券 |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | } |
| | | if(type == 1){//用户分享 |
| | | UserInfo userInfo = userInfoMapper.selectById(uid); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | @Override |
| | | public ResultUtil<LoginWarpper> wxLogin(Integer type, String openid, String unionid, String jscode, String registIp, |
| | | String registAreaCode, Integer sex, String nickName, String avatar,String loginType, |
| | | Integer uid,Integer userType) throws Exception { |
| | | Integer uid,Integer userType,String phone) throws Exception { |
| | | System.err.println("手机号+++++"+phone); |
| | | UserInfo userInfo = null; |
| | | if(type == 2){//小程序 |
| | | if(ToolUtil.isEmpty(jscode)){ |
| | |
| | | System.out.println("unionid===="+unionid); |
| | | userInfo = userInfoMapper.queryByOpenid2(openid); |
| | | |
| | | |
| | | }else{//APP |
| | | userInfo = userInfoMapper.queryByOpenid(openid); |
| | | } |
| | | if (StringUtils.hasLength(phone)){ |
| | | UserInfo userInfo1 = userInfoMapper.queryByPhone(phone); |
| | | if (null != userInfo1){ |
| | | userInfo = userInfo1; |
| | | userInfo.setAppletsOpenId(openid); |
| | | } |
| | | } |
| | | if(null == userInfo){ |
| | | |
| | | // 如果为空 需要生成小程序二维码并携带用户id |
| | | userInfo = new UserInfo(); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | |
| | | inviteMapper.insert(invite); |
| | | if (userType==1){ |
| | | // 只有用户邀请用户会获得优惠券 |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(1); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | |
| | | // 用户id 用于分享 |
| | | param.put("scene", "uid="+userInfo.getId()+"userType=1"); |
| | | |
| | | param.put("env_version", "trial");// 体验版 |
| | | // param.put("env_version", "release");// 正式版 |
| | | // param.put("env_version", "trial");// 体验版 |
| | | param.put("env_version", "release");// 正式版 |
| | | param.put("width", 200); //二维码尺寸 |
| | | param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 |
| | | param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设置手机号码操作 |
| | | * @param uid |
| | |
| | | this.updateById(userInfo); |
| | | |
| | | smsrecordService.saveData(2, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"); |
| | | List<Invite> invites = inviteMapper.selectList(null); |
| | | List<UserInfo> userInfos = this.selectList(null); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Invite invite : invites) { |
| | | UserInfo userInfo2 = userInfos.stream().filter(e -> e.getId().equals(invite.getUserId())).findFirst().orElse(null); |
| | | if (userInfo2==null){ |
| | | integers.add(invite.getId()); |
| | | } |
| | | } |
| | | if (!integers.isEmpty()){ |
| | | inviteMapper.deleteBatchIds(integers); |
| | | } |
| | | return ResultUtil.success(new LoginWarpper()); |
| | | } |
| | | |
| | |
| | | * @throws Exception |
| | | */ |
| | | public synchronized void addCoupon(Integer userId, Double money, Integer companyId, Integer paymentRecordId) throws Exception{ |
| | | List<Map<String, Object>> query = userActivityBalanceService.query(money, companyId); |
| | | List<Map<String, Object>> query = userActivityBalanceService.query(money, 1); |
| | | List<UserCouponRecord> list = new ArrayList<>(); |
| | | for(Map<String, Object> map : query){ |
| | | //添加通用优惠券 |
| | |
| | | * @return |
| | | */ |
| | | public String getDefaultName(){ |
| | | int num = this.selectCount(new EntityWrapper<UserInfo>().ne("flag", 3)) + 1000001; |
| | | int num = this.selectCount(new EntityWrapper<UserInfo>()) + 1000001; |
| | | return "XN" + String.valueOf(num).substring(1); |
| | | } |
| | | |
| | |
| | | */ |
| | | private synchronized void addCoupon(UserInfo userInfo) throws Exception{ |
| | | //添加优惠券 |
| | | List<Map<String, Object>> list = userActivityRegisteredService.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> list = userActivityRegisteredService.query(1); |
| | | int num = 0; |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |
| | |
| | | */ |
| | | private synchronized void addInviteCoupon(UserInfo userInfo) throws Exception{ |
| | | //添加优惠券 |
| | | List<Map<String, Object>> list = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | List<Map<String, Object>> list = userActivityInviteMapper.query(1); |
| | | int num = 0; |
| | | for(Map<String, Object> map : list){ |
| | | if(null != map){ |