/** * 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']); } } } }
public function handle_request_internal() { $start = $this->_params['start']; $rows = $this->_params['rows']; $brokerId = $this->_params['brokerId']; $ret = array('announce_list' => array()); $announce_list = Dao_Msgpush_Announce::get_list($start, $rows); if ($announce_list) { foreach ($announce_list as $v) { $ret['announce_list'][] = array('title' => $v['announce_title'], 'content' => $v['announce_content'], 'createtime' => $v['announce_createtime']); } } return array('status' => 'ok', 'data' => $ret); }
public function handle_request_internal() { $now = $_SERVER['REQUEST_TIME']; $title = $this->_params['title']; $content = $this->_params['content']; $brokerId = $this->_params['brokerId'] ? $this->_params['brokerId'] : 0; $showType = $this->_params['show_type'] ? $this->_params['show_type'] : 0; //消息发布类型0-全部 1-公告 2-推送 if (empty($title) || empty($content)) { return Util_MobileAPI::error(Const_APIStatus::E_PARAM_INVALID); } $arr = array($title, $content, $now, $now, $brokerId, 0, $showType, 0); $r = Dao_Msgpush_Announce::insert($arr); if ($r) { $ret = array('status' => 'ok', 'data' => 'success'); } else { $ret = Util_MobileAPI::error(Const_APIStatus::E_PARAM_INVALID); } return $ret; }
public function get_list_num($datetime) { $T_DAO = new Dao_Msgpush_Announce(); return $T_DAO->get_list_num($datetime); }