微信群发接口调用代码

//找到需要发的微信号,参考https://www.wuliaokankan.cn/url301/138.html
            List<AccountInfo> accList =    accountDao.getAllAccountInfoByTypeCidDid(info.getCid(), info.getDid());
            if(null != accList && accList.size()>0){
                List<String>  whoinvisibleIdList = whoinvisibleIdList(info)    ;//不给谁看
                for(int i=0;i<accList.size();i++){
                    AccountInfo  account = accList.get(i);
                    List<WeChatAccountInfo> weChatIdList = weChatAccountDao.findWeChatAccountInfo(account.getCid(), account.getId());
                    if(null != weChatIdList && weChatIdList.size()>0){
                        for(int j=0;j<weChatIdList.size();j++){
                            WeChatAccountInfo waInfo = weChatIdList.get(j);//哪些微信号需要定时操作
                            //微信号中需要屏蔽的微信号的好友
                            List<String> friendWechatList = whoinvisibleWechatIdList(whoinvisibleIdList, info, waInfo, weChatContactDao);
                            //子任务分别处理  存储子任务详情 
                            if(info.getTasktype()==1){//添加群发任务
                                //找到需要群发的好友微信号,屏蔽不需要群发的人
                                List<String> newfriendWechatList = weChatContactDao.findFriendWeChatIds(waInfo.getWechatid(), friendWechatList);
                                if(null != newfriendWechatList && newfriendWechatList.size()>0){
                                    if(newfriendWechatList.size()<=200){
                                        saveGroupSendTimeTaskDetail(info, newfriendWechatList, waInfo.getWechatid(), timeTaskDetailsDao);
                                    }else{
                                        int subCount = newfriendWechatList.size();
                                        int subSize = 200;
                                        int subPageTotal = (subCount / subSize) + ((subCount % subSize > 0) ? 1 : 0);
                                        // 根据页码取数据
                                        for (int x = 0, len = subPageTotal - 1; x <= len; x++) {
                                            // 分页计算
                                            int fromIndex = x * subSize;
                                            int toIndex = ((x == len) ? subCount : ((x + 1) * subSize));
                                            List<String> strings = newfriendWechatList.subList(fromIndex, toIndex);
                                            
                                            String dat = info.getExecute_time();
                                            Date dte = DateUtil.convertString2Date(dat, DateUtil.DATE_FORMAT_4);
                                            long  times = dte.getTime() + (x * 1000 * 60 *10);
                                            dat = DateUtil.convertDate2String(new Date(times), DateUtil.DATE_FORMAT_4);
                                            info.setExecute_time(dat); 
                                            
                                            saveGroupSendTimeTaskDetail(info, strings, waInfo.getWechatid(), timeTaskDetailsDao);
                                        } 
                                    }
                                }
                            }else if(info.getTasktype()==2){//发朋友圈
                               saveCircleSendTimeTaskDetail(info, friendWechatList, waInfo.getWechatid(), timeTaskDetailsDao);
                            }
                        }
                    }
                }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值