public function handle_request() { if ($this->_brokerId == 0) { echo sprintf('Usage: launcher.php Monitor_CheckBrokerHasCombo --broker=[:number:] [--site=[ajk|hz|jp]] [--release=...]'), PHP_EOL; return; } $this->logMsg('开始处理.....'); try { $userId = Bll_Broker::getBrokerUserIdByBrokerId($this->_brokerId); } catch (Exception $e) { $this->logMsg($e->getMessage()); return; } $brokerCurrentCombo = Model_Combo_ComboOrder::getBrokerCurrentCombo($userId, $this->_siteType); if (empty($brokerCurrentCombo)) { file_put_contents($this->_noComboBrokerLogFile, $this->_brokerId . PHP_EOL, FILE_APPEND); $this->logMsg('经纪人没有生效的套餐'); return; } $this->logMsg(sprintf('经纪人有生效的套餐:%s', json_encode($brokerCurrentCombo))); $this->logMsg('处理完成.....'); }
/** * * 根据userid获取经纪人套餐日志(分页) * * @param $userId * @param $page * @param $page_num */ public static function getComboLogListByUserId($userId, $page, $page_num) { if (!isset($page)) { $page = 1; } $start_num = ($page - 1) * $page_num; $ComboLogList = Model_Combo_ComboOrderLog::getComboLogListByUserId($userId, $start_num, $page_num); foreach ($ComboLogList as $key => $list) { //获取订单信息 $orderInfo = Model_Combo_ComboOrder::getComboOrderById($list['orderId']); //信息拼装 $list['comboName'] = $orderInfo['comboName']; //套餐名称 $list['salePropNum'] = $orderInfo['salePropNum']; //二手房推广数 $list['rentPropNum'] = $orderInfo['rentPropNum']; //租房推广数 $list['jpPropNum'] = $orderInfo['jpPropNum']; //金铺推广数 $list['startTime'] = strtotime($orderInfo['startTime']); //开始时间 $list['endTime'] = strtotime($orderInfo['endTime']); //结束时间 $list['day'] = floor((strtotime(date('Y-m-d', $list['endTime'])) - strtotime(date('Y-m-d', $list['startTime']))) / 86400) + 1; //套餐天数 //套餐内容组装 $list['comboStr'] = ''; if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($orderInfo) && $orderInfo['jpPropNum'] <= 0) { $list['comboStr'] = sprintf('房源%d套(二手房、住宅租赁)', $orderInfo['salePropNum'] + $orderInfo['rentPropNum']); } else { if ($orderInfo['salePropNum'] > 0) { $list['comboStr'] .= $list['comboStr'] ? ',' : ''; $list['comboStr'] .= sprintf('房源%d套(二手房)', $orderInfo['salePropNum']); } if ($orderInfo['rentPropNum'] > 0) { $list['comboStr'] .= $list['comboStr'] ? ',' : ''; $list['comboStr'] .= sprintf('房源%d套(住宅租赁)', $orderInfo['rentPropNum']); } } if ($orderInfo['jpPropNum'] > 0) { $list['comboStr'] .= $list['comboStr'] ? ',' : ''; $list['comboStr'] .= sprintf('房源%d套(商铺、写字楼)', $orderInfo['jpPropNum']); } //类型名称转换'optType' => 'opt_type',//1,个人购买;2,公司购买,3,公司转入;4,公司转出 //展示类型:购买/转入/转出 //备注展示:公司账户付费、个人账户付费、公司转入、公司转出 if ($list['optType'] == 1) { $list['optName'] = '购买'; $list['note'] = '个人账户付费'; } elseif ($list['optType'] == 2) { $list['optName'] = '购买'; $list['note'] = '公司账户付费'; } elseif ($list['optType'] == 3) { $list['optName'] = '转入'; $list['note'] = '公司转入'; } elseif ($list['optType'] == 4) { $list['optName'] = '转出'; $list['note'] = '公司转出'; } elseif ($list['optType'] == 5) { $list['optName'] = '升级'; $list['note'] = '个人升级'; } elseif ($list['optType'] == 6) { $list['optName'] = '升级'; $list['note'] = '公司升级'; } else { $list['optName'] = '其他'; } $ComboLogList[$key] = $list; } return $ComboLogList; }