/** * Job执行逻辑 */ public function handle_request() { //读取公告列表数据 $queueList = $this->readAnnounceQueueInfo($this->announceId); if (!empty($queueList)) { $broker_queue = $this->brokerId; //从ajk_dw_stats库里读取本次操作的经纪人信息 $DwStatsBll = Bll_DwStatsBiz::get_instance(); $where = " broker_id>{$broker_queue} order by broker_id asc limit 1"; $DwStats_broker = $DwStatsBll->get_distinct_broker($where); if (!empty($DwStats_broker)) { //添加逻辑判断待发送信息的经纪人是否开通微聊 $activeBorker = Model_Mobile_BrokerChatInfo::getActiveBroker($DwStats_broker[0]['broker_id'], array('chatId')); $chatId = $activeBorker['chatId']; foreach ($queueList as $list) { if (!empty($activeBorker)) { //发送公众号信息 $msg_map = APF::get_instance()->get_config('msg_conf', 'mobile_api'); $text = $msg_map['ANNOUNCE_PUSH'] . $list['announce_content']; $result = Bll_Chat::sendPublicMsg($chatId, $text); } else { $this->write_redis($DwStats_broker[0]['broker_id'], 'ANNOUNCE_PUSH', $list['announce_content'], 'mobile-ajk-broker'); $this->writeLog($this->log_dir . 'broker_queue.id', $DwStats_broker[0]['broker_id']); } } } else { $this->writeLog($this->log_dir . 'broker_queue.id', 0); foreach ($queueList as $list) { //更新公告队列 Dao_Msgpush_Announce::update($list['announce_id']); $this->writeLog($this->log_dir . 'announce_queue.id', $list['announce_id']); } } } }